Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Forms Authentication
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00672857
Message ID:
00673252
Views:
16
Cathi,
Here is what I came up with, what do you think, is this okay, or do you know something better?
//string of the requestor's URL
string cookieName = FormsAuthentication.GetRedirectUrl( txtUserName.Text, false ).Trim();

//start position of my cookie name
int startCookie = cookieName.LastIndexOf( "/" ) + 1;

//ending position of my cookie name
int cookieLength = cookieName.LastIndexOf( "." ) - startCookie;

//parse the redirect URL to get a dynamic cookie name
cookieName = "." + cookieName.Substring( startCookie, cookieLength ) + "Auth";
				
//get the cookie
HttpCookie cookie = FormsAuthentication.GetAuthCookie( txtUserName.Text, false );

//give it my new name
cookie.Name = cookieName;

//add it to the response object
Response.Cookies.Add( cookie );

//navigate back to the original requestor
Response.Redirect( FormsAuthentication.GetRedirectUrl( txtUserName.Text, false ) );
I don't know how much I like this, mainly because the forms element's name attribute (in the web.config of the protected app) must be equal to "." + the defualt start page + "Auth" (in this case ".PHYSCNTAuth"). I don't know if I like putting a "Have to do it this way" in there, but oh well.
Thanks again for all the help and advice, and anything else you have to offer on this, it is greatly appreciated!
jfh
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform