I got a 2 ASP.NET solution. The first one is called HomePage and the other Main. I’m using IIS 7.5. At the root of IIS, I got 2 folders with the same name (HomePage and Main). Each solution is in their own folder.
I’m trying to transfer a session from HomePage to Main.
Main project (file ASPNETToASPNET.aspx)
private void Page_Load(object sender, System.EventArgs e)
{
string queryString = String.Empty;
string destPage = Request.Form["destpage"].ToString();
...
}
HomePage.aspx
private void Redirect_Click(object sender, CommandEventArgs e)
{
Response.Redirect("http://www.website.com/Main/Pages/ASPNETToASPNET.aspx?destpage=" + e.CommandArgument + "&SessionNoClient=" + Session["SessionNoClient"], false);
Response.Redirect("./Main/Pages/ASPNETToASPNET.aspx?destpage=" + e.CommandArgument + "&SessionNoClient=" + Session["SessionNoClient"], false);
}
When using the first redirect, I reach the appropriate file, but I got an error at line
string destPage = Request.Form["destpage"].ToString();
Object reference not set to an instance of an object.
When using the other redirect, I’m not able to find a way to reach the appropriate file.
As mentioned, both solutions are on same server and use the same domain.
Any solutions?
Request.Formcollection contains POST values. For query string parameters (GET) useRequest.QueryStringorRequest.Params, the last one searches your value inQueryString,Form,Cookies, andServerVariables.