asp.net - Error trapping on the Response.Redirect -
we using response.redirect
send users web site take questionnaire. have database stores information user's eligibility take survey , if eligible, 'take survey' button appears on home page , variable stores url survey.
on takesurvey_click
event, code following:
formsauthentication.signout(); response.redirect(theurl);
pretty straight forward , worked great years. recently, have changed web site user being redirected. there have been no issues many thousands of users; however, reasonably significant group (2-3%), nothing happens when press 'take survey' button.
i reasonably after searching internet, have tried of recommended methods handling situation, none want. happen is, if take survey doesn't send user link (btw, have checked link being generated non-working links, , links), want informational page appear telling them having issues , if send information environment, useful in fixing issue. seems simple enough, no matter try, either can't page not display, or, if use override , send false, never displays , never redirects.
anyone have ideas?
response.redirect
sends "302 moved" response browser. browser responsible navigating destination url.
thus, once you've issued response.redirect
, it's out of hands , there no easy way detect browser has not navigated chosen url.
now, there few different ways (that can think of deal this):
- you might able set
document.location
client-side javascript. - the page issues redirect refresh periodically (using javascript or
meta refresh
). if finds still on same page after should have gone somewhere else, can issue warning. - or, more simply, page issues redirect have instructions stating "we're sending take survey. if, after 30 seconds, you're still looking @ message, went wrong.".
Comments
Post a Comment