.NET 4.0 Framwork problem

wiggy353
wiggy353 used Ask the Experts™
on
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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

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

Author

Commented:
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.

Author

Commented:
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?
Commented:
Just so everyone knows, this turned out to be a known issue with ASP.NET 4. For information on it look here:

http://www.asp.net/learn/whitepapers/aspnet4/breaking-changes#0.1__Toc256770149

Author

Commented:
I found this answer somewhere else.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial