failed to load in the web form designer...

J

Jona Kee

I have web pages that inherit from a custom page class. I now get the
following error:

"The file failed to load in the web form designer. ... Object
reference not set to an instance of an object."

This occured after I added the following line of code in the base
class constructor:

if(User.Identity.Name.Length > 0)

Any way around this?

Thanks for your help.
 
M

Marina

As a guess, it looks like the constructor is executed when the form designer
loads? And at design time, that expression can't be evaluated, because User
is not set to anything.

My recommendation would be to put that code into Page_Init or Page_Load.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top