简体   繁体   中英

Why doesn't redirect work?

I am using this code to redirect to page and then want to activate a specific tab among several tabs but it doesn't work. Why ? I mean anything after redirect doesn't work or display. I debugged , it hits the code after redirect code but no effect on front end.

Response.Redirect(Request.RawUrl, false);

tabContainer.ActiveTabIndex = 1;

ShowMsg("Data Updated");

As you can see on MSDN Response.Redirect ends the current request immediately and navigates to the new Url. That is why your following code is not executed.

If you want to do some additional actions on the Url you redirect your response to, you should think about adding some Parameters, eg Url Parameters, that get evaluated by the new Url.

The false you are passing to the Response.Redirect just prevents that a ThreadAbortException is thrown.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM