views:

41

answers:

2
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server" method="post">
    <div>

    </div>
    </form>
</body>
</html>



namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Redirect("/WebForm1.aspx?ID=100");
        }
    }
}

Second Page

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server" method="post">
    <div>

    </div>
    </form>
</body>
</html>

     protected void Page_Load(object sender, EventArgs e)
            {
                string ID = Request.QueryString["ID"].ToString();
            }

I am trying to get querystring value using post method, but value is not retrieved. Please Help

A: 

Use Request.Form["var"]

Check this http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx

Guilherme Ferreira
A: 

Or try

string ID = Request.Params.Get("ID");
kad1r