Article ID: 917412 - Last Review: December 3, 2007 - Revision: 1.5 You may be redirected to the forms authentication logon page, or you may receive an error message when you try to run an application that is built by using the .NET Framework 2.0SYMPTOMSWhen you try to run an application that is built by using
the Microsoft .NET Framework 2.0, you may be redirected to the forms
authentication logon page. Alternatively, you may receive an error message that
resembles the following: Server Error in
'/WebSites1' Application. -------------------------------------------------------------------------------- Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. This problem may occur when one or both of the following conditions are true:
CAUSEThis problem occurs because the HttpOnly attribute prevents any client script from accessing the session
cookie. The HttpOnly attribute is added to the session cookie in the .NET Framework
2.0. RESOLUTIONTo resolve this problem, set the HttpOnly attribute for the session cookie to the false value. Note Setting the HttpOnly attribute to the true value does not prevent a malicious user from accessing the cookie directly when the malicious user has access to the network channel. Consider using Secure Sockets Layer (SSL) to help protect against this. Workstation security is also important. A malicious user may use an open browser window or a computer that contains persistent cookies to access a Web site by using a legitimate user's identity. To set the HttpOnly attribute to the false value, replace the Session_Start method in the Global.asax file by using the following code. MORE INFORMATIONFor more information about the HttpOnly attribute, visit the following Microsoft Developer Network (MSDN)
Web site: http://msdn2.microsoft.com/en-us/library/system.web.httpcookie.httponly.aspx
(http://msdn2.microsoft.com/en-us/library/system.web.httpcookie.httponly.aspx)
For more information about the HttpModule class, visit the following MSDN Web site: http://msdn2.microsoft.com/en-us/library/zec9k340(vs.71).aspx
(http://msdn2.microsoft.com/en-us/library/zec9k340(vs.71).aspx)
For more information about breaking changes in the .NET Framework
2.0 and in the HttpOnly attribute, visit the following MSDN Web site:http://msdn2.microsoft.com/en-us/netframework/aa497240.aspx
(http://msdn2.microsoft.com/en-us/netframework/aa497240.aspx)
The
third-party products that this article discusses are manufactured by companies
that are independent of Microsoft. Microsoft makes no warranty, implied or
otherwise, regarding the performance or reliability of these products.
| Article Translations
|
Back to the top
