I am building my first ASP.Net web application project in VS2010. The site has a master page which all the content pages use.
I have published it to a local Windows 2008 R2 server running IIS 7.5 – so other members of the team can have a look.
I published it using ‘File System’ to a directory on the server. If I look in the directory on the server, all I see are .aspx files and a few dlls – which is what I would expect.
If I go into IIS and try to browse the web application (or open a browser on my local box and go to http://myserver/Contacts – I get a Server Error – ‘the file Contacts/MasterPage1.master.cs’ does not exist.
I don’t understand – why is IIS looking for a .cs file when, in a web application project – all the .cs files are compiled into a dll?
Check few things:
Check if you are you referring to master page type using
CodeFile="..."orCodeBehind="..."attributes. If you are usingCodeFilechange toCodeBehind, or even better right click on your project and click Convert to Web projectTry adding namespace when referring to master page (
Inherits="Project.MasterPage")