Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Thank you to those taking time out to read and help out with this. The project is a volunteer one for a local gaming LAN group.

Problem:
A gamer comes in and hasn't paid or registered on the site. We allow them to do the register process and when it asks them to complete check-in, they can't because in the system they have not paid yet. So, an admin logs in and selects his new username from a dropdown menu in a table. The admin then selects "cash paid" and in order for that to update, the admin must then refresh. After the refresh, it forces the admin to be logged out and the admin must then log back in and then it updates and shows the gamer as paying cash and they can then complete login.

If any additional code or detail is needed, please let me know. This is where I'm thinking that the mishap is occurring. Thank you again.

Code behind:
protected void CheckoutButton_Click(object sender, EventArgs e)
       {
           FormsAuthentication.SignOut();
           Session.Abandon();

           //Clear Authentication Cookie.
           HttpCookie cookie1 = new HttpCookie(FormsAuthentication.FormsCookieName, "");
           cookie1.Expires = DateTime.Now.AddYears(-1);
           Response.Cookies.Add(cookie1);

           // clear session cookie (not necessary for your current problem but i would recommend you do it anyway)
           HttpCookie cookie2 = new HttpCookie("ASP.NET_SessionId", "");
           cookie2.Expires = DateTime.Now.AddYears(-1);
           Response.Cookies.Add(cookie2);
           Response.Redirect("~/Checkin.aspx");
           //FormsAuthentication.RedirectToLoginPage();
       }


What I have tried:

I've tried tweaking the code, taking a few things out. I've worked on it for a few days now but I'm new and rusty.
Posted
Comments
Vincent Maverick Durano 15-Jan-17 17:00pm    
Why don't you just redirect the user to the page and remove your logout and cookies clearing?
Aseeraa 15-Jan-17 18:00pm    
So removing the majority of this code and replacing it with Response.Redirect()?
Sunasara Imdadhusen 17-Jan-17 6:55am    
i think only Response.Redirect() should work!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900