Martin Smellworse
Martin Smellworse

Reputation: 1752

IIS looking for .cs file in compiled .net site

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?

Upvotes: 6

Views: 5274

Answers (1)

Nikola Radosavljević
Nikola Radosavljević

Reputation: 6911

Check few things:

  • Check if you are you referring to master page type using CodeFile="..." or CodeBehind="..." attributes. If you are using CodeFile change to CodeBehind, or even better right click on your project and click Convert to Web project

  • Try adding namespace when referring to master page ( Inherits="Project.MasterPage" )

Upvotes: 13

Related Questions