Avatar of wiggy353
 asked on

.NET 4.0 Framwork problem

I am having problems with code as simple as this:

   protected void Page_Load(object sender, EventArgs e)
        Response.Write("Current User: <strong>" + System.Environment.UserName + "</strong><br><br>");
        Response.Write("Current User: <strong>" + HttpContext.Current.User.Identity.Name.ToString() + "</strong>");

Open in new window

If I have it on an application pool that uses .NET 2.0, it works fine. If I change the .NET to 4.0 it doesn't work any more.

Please help.
Microsoft IIS Web Server.NET App ServersASP.NET

Avatar of undefined
Last Comment

8/22/2022 - Mon

what is "doesn't work any more"? errors?

I change it to 4.0 application pool and reload the page and get this:

Server Error
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.

The only thing I change in IIS is the version of .NET that the application pool is using and then I get the error mentioned above. What could be causing this?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

I found this answer somewhere else.