Last post Oct 05, 2017 04:37 AM by markfitzme
Oct 04, 2017 01:39 PM|rhondadunn|LINK
I have an application in which the user needs to verify their account before they proceed to the rest of the application. To do this, I have a call to the database to see if the user is verified. If not, I have a Response.Redirect to the verification page.
Session["username"] = dt.Rows["email"].ToString();
lblMessage.Visible = false;
//check to see if account is verified. If not, redirect to verification page. Else - continue.
string username = Session["username"].ToString();
clClass check_valid = new clClass();
DataTable getIsVerified = check_valid.fIsVerified(username);
sring verified = getIsVerified.Rows["account_verified"].ToString();
if (verified == "N") //confirm account is verified before user can proceed
//redirect to verification page
//continue on in application
When I step through the program, it does hit the response.redirect; however, instead of redirecting to the verification page, it unloads the page. This cuases an issue with populating other fields and I get an error message and the program crashes.
Any ideas or suggestions are appreciated.
Oct 05, 2017 04:37 AM|markfitzme|LINK
A response.redirect will normally terminate thread processing at that point since there is no reason for it to continue as it sends a 302 redirect to the browser to proceed to the requested url. If you have Response.Redirect, you are essentially telling
the server I'm done and you don't need to do anything else. There is an overload on the Response.Redirect though that takes a string for the url and a Boolean parameter that tells the server whether or not it should abort the thread.