Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link cookie to proper domain by referencing web.config & Save

Status
Not open for further replies.

expresso100

Programmer
Aug 6, 2006
6
US
I need to "tie together the cookie with the domain" by referencing the information from my web.config below in my login's codebhind. I don't understand how. I need to also save that after doing so:

<add key="cookieDomainName" value=".test.com" />

<authentication mode="Forms">
<forms loginUrl="login.aspx" name="CH.COM.AUTH" path="/"/>
</authentication>

something like this:
HttpContext.Current.Application.GetKey(cookieDomainName);
then tie the cookie to the form name?

Here's the skeleton of our login.aspx.cs:

public partial class login : Web.BasePage
{
protected void Login1_LoggedIn(object sender, EventArgs e)
{
Login login = (Login)LoginView1.FindControl("Login1");

CMembershipUser user = (CMembershipUser)Membership.GetUser(login.UserName);
ProfileCommon profile = Profile.GetProfile(login.UserName);
profile.User.CUserID = user.CUserID.ToString();
profile.Save();

HttpContext.Current.Application.GetKey(cookieDomainName); <<---my attempt here to start relating the cookie to the domain...this is probably incorrect.
}

}

I'm completely lost. I know this is simple but I haven't done much with cookies in .NET 2.0. We are using the membership api in 2.0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top