D
Danny Ni
Hi guys,
I am working on a shopping cart application, it works fine on a stand alone
sever, but not on a web farm environment. The items I added to shopping cart
could disappear suddenly, I think the following codes might have somthing to
do with the problem.
string cookiedata;
HttpCookie authcookie =
Request.Cookies[FormsAuthentication.FormsCookieName];
if (authcookie != null)
{
cookiedata = authcookie.Value;
FormsAuthenticationTicket ticket =
FormsAuthentication.Decrypt(cookiedata);
if (ticket.Name.Trim() != string.Empty)
{
Guid g = new Guid(ticket.Name);
DB.ExecuteSQL("update Customer set LastIPAddress=" +
DB.SQuote(CommonLogic.ServerVariables("REMOTE_ADDR")) + " where
CustomerGUID=" + DB.SQuote(g.ToString()));
Customer ThisCustomer = new Customer(g, AppLogic.IsAdminSite);
Context.User = new AspDotNetStorefrontPrincipal(ThisCustomer);
}
else
{
FormsAuthentication.SignOut();
Context.User = new AspDotNetStorefrontPrincipal(new
Customer(AppLogic.IsAdminSite));
}
}
else
{
//insert a record into customer table and do something else
}
Does FormsAuthentication info persist from one server to another?
TIA
I am working on a shopping cart application, it works fine on a stand alone
sever, but not on a web farm environment. The items I added to shopping cart
could disappear suddenly, I think the following codes might have somthing to
do with the problem.
string cookiedata;
HttpCookie authcookie =
Request.Cookies[FormsAuthentication.FormsCookieName];
if (authcookie != null)
{
cookiedata = authcookie.Value;
FormsAuthenticationTicket ticket =
FormsAuthentication.Decrypt(cookiedata);
if (ticket.Name.Trim() != string.Empty)
{
Guid g = new Guid(ticket.Name);
DB.ExecuteSQL("update Customer set LastIPAddress=" +
DB.SQuote(CommonLogic.ServerVariables("REMOTE_ADDR")) + " where
CustomerGUID=" + DB.SQuote(g.ToString()));
Customer ThisCustomer = new Customer(g, AppLogic.IsAdminSite);
Context.User = new AspDotNetStorefrontPrincipal(ThisCustomer);
}
else
{
FormsAuthentication.SignOut();
Context.User = new AspDotNetStorefrontPrincipal(new
Customer(AppLogic.IsAdminSite));
}
}
else
{
//insert a record into customer table and do something else
}
Does FormsAuthentication info persist from one server to another?
TIA