The name ‘model’ does not exist in the current context

This blog post is about the error “CS0103: The name ‘model’ does not exist in the current context’ when developing with EPiServer 7 Preview.

Background & cause

IntelliSense won’t recognize the keyword @model in your view.


When running the site we get the yellow screen of death.


This happened because I manually created the “Views”-folder and forgot to add the necessary configuration files that otherwise is auto-generated by Visual Studio for MVC 4 websites.


Create a web.config directly beneath the “Views”-folder and add the configuration below (this is the default configuration added by Visual Studio when creating an ASP.NET MVC 4 website).

Make sure to close and re-open your index file after having added the configuration file. Now you should have access to the @model keyword and can access the model through @Model.


Hope this helps anyone that might – like me – be a little careless when deleting auto-generated project resources.

Recent Posts
  • Nice, I’m looking for this one. Thanks!

  • Jose

    I have spent hours fighting this bug in a remote server. Thanks for taking the time to write it down!!!

  • Aleks

    That did the trick. Thanks for posting this, as it saved me a ton of time.

  • Thank you sir!

  • sDhiraj


  • TJ

    I needed that. I was comparing to another existing project I was still missing parts of the config file. THANK YOU!

  • Sam Martin


  • ajay

    i want to export table in to excel using mvc2
    in view page how to fill model in to export to excel button

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Not readable? Change text. captcha txt

Start typing and press Enter to search