简体   繁体   中英

Add URL variables with Server.Transfer in asp.net

I am currently trying to add a variable to the url using Server.Transfer. I need to use Server.Transfer as I need to keep form post data which is why I can't use Response.Redirect.

I am using Server.Transfer("add_account.aspx?error=userNotFound"); but the variable is not being added to the URL.

Thanks for your help.

Usually with Server.Transfer, we use context to pass data around:

Context.Items["error"] = "UserNotFound";
Server.Transfer("add_account.aspx");

This is a state container like Session and Application, but it only persists for the current request and then goes away.

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