Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Forms Authentication
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00672857
Message ID:
00673252
Vues:
15
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform