0

My ASP.NET application has stopped working after I migrated it to another server.

The problem is that I cannot send more than one value via the query string.

The URL I'm trying looks like this:

ThisIsSecondPage.aspx?Mode=Edit&ID=0001

I can capture the value of Mode in ThisIsSecondPage.aspx, but ID is blank.

I also tried to change ID to something line A0001, but it did not work.

I also tried:

ThisIsSecondPage.aspx?Mode=Edit<and>ID=0001 

Can anyone help me please?

1
  • how to get querystring in ThisIsSecondPage.aspx ? Commented Apr 18, 2018 at 16:39

2 Answers 2

1

send querystring like this

ThisIsSecondPage.aspx?Mode=Edit&ID=0001

and recive in page_load event of ThisIsSecondPage page:

protected void Page_Load(object sender, EventArgs e)
    {
        string ModeParam = "";
        string IDparam = "";
        if(Request.Params["Mode"] !=null)
            ModeParam = Request.Params["Mode"].ToString();
        if (Request.Params["ID"] != null)
            IDparam = Request.Params["ID"].ToString();

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

Comments

0

You are passing query string correctly.

ThisIsSecondPage.aspx?Mode=Edit&ID=0001

In second page, Use as below

For Mode

string ModeValue = Request.QueryString["Mode"];

or in short form,

string ModeValue = Request["Mode"];

For ID

string IDValue = Request.QueryString["ID"];

or in short form,

string IDValue = Request["ID"];

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.