-3

What I want to do is access the value passed to a webpage (GET, POST request) using asp.net. To be more clear, for example:

URL: http://www.foobar.com/SaleVoucher.aspx?sr=34

Using asp.net I want to get the sr value i.e 34.

I'm from the background of C# and new to ASP.NET and don't know much about ASP.NET.

4
  • In that question is your answer stackoverflow.com/questions/979975/… Commented Jul 9, 2013 at 10:28
  • @luk2302 lol I needed to type ASP.NET Commented Jul 9, 2013 at 10:30
  • 1
    @KamranAhmed LOL, yes, because you changed the tags/topic of your question after we answered, that is not nice nor should you complain afterwards. Commented Jul 9, 2013 at 10:32
  • U can find the answer here: stackoverflow.com/questions/1403888/… Commented Jul 9, 2013 at 10:32

2 Answers 2

1

Can you refer to this QueryString

Here he says how to access the query string using:

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

Comments

0

That is not called a Header, but the Query String.

the object document.location.search will contain that and the javascript to get any query string value based on the key would be something like:

function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}

code from other question: https://stackoverflow.com/a/901144/28004

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.