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:
00673333
Vues:
21
You said:
< 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").>

The naming convention you use is up to you. The main reason for needing to do this coding is because there are two web.config files. Have you tried this code and getting the expected results?


>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
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform