Link to home
Start Free TrialLog in
Avatar of zhshqzyc
zhshqzyc

asked on

Redirect page and pass the string to that page as well.

I want to redirect a page and also pass a string to that web page as well.

Thanks for the advice.
Response.Redirect("~/admin/test.aspx?UserName=" + Server.UrlEncode(UserName), false);
                                    Response.Redirect("~/admin/test.aspx");

Open in new window

Is it correct?
Avatar of binaryevo
binaryevo
Flag of United States of America image

Line 1 looks fine to me.  This will redirect you to the appropriate page and append the querystring appropriately.
Avatar of zhshqzyc
zhshqzyc

ASKER

But if there is only line 1, it doesn't jump the new page because of "false". If set "true" I will get an exception.
Use server.transfer... Its a better option much of the time.  See below:

http://arplis.com/difference-between-server-transfer-and-response-redirect/
ASKER CERTIFIED SOLUTION
Avatar of BuggyCoder
BuggyCoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial