J
Joe Reazor
First, here's a quick description of what I have so far. I have a website
that I am building that contains both asp and asp.net pages. I have
configured the site using a custom HTTPHandler, web.config, and a custom
HTTPModule so that all requests (both asp and asp.net) go through the
asp.net runtime. Asp requests are then redirected to the asp handler and
asp.net are processed as normal. The entire site is then password protected
using forms authentication and authorization to any page or sub app is
controlled through the web.config in my root web. My custom HTTPModule
handles the Authenticate Request event so that I can check my cookie, that I
set on my login page, decrypt it and get my user and group info. All of
this works perfectly on the asp.net side. I now want to be able to use that
same cookie that I can access in my regular old asp pages decrypt it and get
my user info. I made a class that uses the FormsAuthentication Class and
thought I could decrypt my cookie that way. The problem I found was that
the FormsAuthentication class only works when called within a asp.net
application because when you call the Decrypt method it initializes which
looks for the encryption keys in the web.config file. My custom class
called from an asp page through interop obviously does not have this, so I
get this error:
System.NullReferenceException: Object reference not set to an instance of an
object. at System.Web.Security.FormsAuthentication.Initialize() at
System.Web.Security.FormsAuthentication.Decrypt(String encryptedTicket) at
CustomHandlers.AuthenticationAccessor.SetAuthTicket(String CookieValue)
Does anyone have any ideas how I might be able to decrypt the cookie on the
ASP side of things? Would not using the Encrypt method of the
FormsAuthentication class on my login page and instead writing a custom
encrypter be the best way to go?
==============
Joe Reazor
Gorbel Inc.
email: joerea=AT=gorbel=DOT=com
that I am building that contains both asp and asp.net pages. I have
configured the site using a custom HTTPHandler, web.config, and a custom
HTTPModule so that all requests (both asp and asp.net) go through the
asp.net runtime. Asp requests are then redirected to the asp handler and
asp.net are processed as normal. The entire site is then password protected
using forms authentication and authorization to any page or sub app is
controlled through the web.config in my root web. My custom HTTPModule
handles the Authenticate Request event so that I can check my cookie, that I
set on my login page, decrypt it and get my user and group info. All of
this works perfectly on the asp.net side. I now want to be able to use that
same cookie that I can access in my regular old asp pages decrypt it and get
my user info. I made a class that uses the FormsAuthentication Class and
thought I could decrypt my cookie that way. The problem I found was that
the FormsAuthentication class only works when called within a asp.net
application because when you call the Decrypt method it initializes which
looks for the encryption keys in the web.config file. My custom class
called from an asp page through interop obviously does not have this, so I
get this error:
System.NullReferenceException: Object reference not set to an instance of an
object. at System.Web.Security.FormsAuthentication.Initialize() at
System.Web.Security.FormsAuthentication.Decrypt(String encryptedTicket) at
CustomHandlers.AuthenticationAccessor.SetAuthTicket(String CookieValue)
Does anyone have any ideas how I might be able to decrypt the cookie on the
ASP side of things? Would not using the Encrypt method of the
FormsAuthentication class on my login page and instead writing a custom
encrypter be the best way to go?
==============
Joe Reazor
Gorbel Inc.
email: joerea=AT=gorbel=DOT=com