简体   繁体   中英

Is there any way to POST values while redirecting to an ASPX page from a Code Behind method

Is there any way to POST values while redirecting to an ASPX page from Code Behind, I can send it using a get like below

Response.Redirect("AdminRegisterTeacherEdit.aspx?messageID=" + messageID);

So, AdminRegisterTeacherEdit.aspx page retrieves the messageID, but it can be seen in the URL, I need to do it from a code behind method using POST, Please suggest me a way.

Use Session instead, like this:

Session["YourIDValues"] = YourListOfIDValues;

Note: Session holds objects, so you can put whatever you want in Session .

To retrieve the value from Session you need to do this:

if(Session["YourIDValues"] != null)
{
    List<string> myListOfIDValues = Session["YourIDValues"] as List<string>;
}

Note: You must cast the object to the right type when retrieving the value from Session cache.

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