Dilukshan Mahendra
Dilukshan Mahendra

Reputation: 3398

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.

Upvotes: 1

Views: 83

Answers (1)

Karl Anderson
Karl Anderson

Reputation: 34846

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.

Upvotes: 2

Related Questions