views:

95

answers:

2

I have an edit page which is used from different sources. After editing I would like to redirect user to original page. Earlier I used ID (given as a parameter) and Action (hard-coded) to redirect user to certain page, but problems occurs when many different pages can access the same edit page.

Any suggestions how to handle this situation? Should I store complete URL and pass it as a parameter? Are there any known issues with that (string length etc.)?

+2  A: 

You can use query string parameter "ReturnUrl" as you suggested or Request.UrlReferer.

Branislav Abadjimarinov
Thanks, I'll try that one. I have to "carry" this url few steps because I am using wizard-like user-interface on this editing page
Tx3
+2  A: 

I use something like this when i i need the referring page.

var referrer = HttpContext.Request.UrlReferrer; if (referrer != null) { return Redirect(referrer.ToString()); } return RedirectToAction("Index");

Kevin McPhail