Search code examples
c#asp.netwebformsmaster-pages

Object reference not set to an instance of an object in Page declaration


I am having an issue with an existing site that was functioning until last week. When I open the site in VS 2013 I get a "Object reference not set to an instance of an object" error/warning on the page declaration of the .aspx pages and .master pages. The website builds correctly but when run only displays a blank page and no errors.

I have verified that the code behind file exists and it's namespace and class are properly entered into the page declaration. Adding a new page to the project gets the same error and I have verified the references are all present. The website is with 3.5 framework. Any help would be appreciated. Thanks.

Clayton

Image of error message


Solution

  • Since I wasn't making any headway in getting this resolved I decided to create a new web project and move all the existing files into the new project. I decided to do this one file at a time to see if I could nail down the page or setting causing the issue. All the files copied over and the site ran as expected until I started to tweek the web config file to match some of the settings from the old project. Everything worked until I added the line

    <identity impersonate="true" userName="domain\Username" password="Password" />
    

    Once I saved and ran the webpage I started getting the same errors from the other project. Commenting out this line resolved the issue for me but now I've got to figure out why that would cause such a strange issue.

    Thanks everyone for their time.

    Edit: Oddly enough the line works without specifying the user account so if I put <identity impersonate="true" /> then everything works as expected.