Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I opened two same pages in different tabs. the URL of the first tab is
domainname/Summary.aspx?a=xxxx&b=xxxx1
and for second is
domainname/Summary.aspx?a=xxxx&b=xxxx2


when I try to retrieve the current location of the web page. it shows the same return for both. how can I get URL of current or button cliked page.

What I have tried:

string MyUrl = HttpContext.Current.Request.Url.AbsoluteUri

firstvalue = HttpContext.Current.Request.QueryString["a"]

secondvalue = <pre>HttpContext.Current.Request.QueryString["b"]


even when I use the session to retrieve the value of a and b. both returned the same value
For example, the value of a is 1 and b is 01 for the first page
and the value of a is 2 and b is 02 for the second page

but when I click on the button on any page from these two. it shows the same value a is 2 and b is 02.
Posted
Comments
Richard Deeming 5-Feb-21 5:12am    
Not clear. If you're storing values in the session, then you'll always get the same value, since there can only be one session per browser per user. But if you're using the QueryString collection, it will always return the value from the querystring of the current page.

Update your question and show the relevant parts of the affected code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900