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">

<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">

<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

3
  • What error did you get ? Maybe a null when id is not exist ? Commented Aug 13, 2010 at 9:59
  • It's not a test question. Sometimes value is not passed and sometimes querystring is appended to the url. Commented Aug 13, 2010 at 9:59
  • querystring value is still visible in the url. Commented Aug 13, 2010 at 10:28

2 Answers 2

1

Use Request.Form["var"]

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

Sign up to request clarification or add additional context in comments.

Comments

1

Or try

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.