[Asp.net] Get current Page URL absolute URI and query string parameters.

[Asp.net] Get current Page URL absolute URI and query string parameters.

Here we will see how to get current page URL, absolute URI and query string parameters. we will use below URL.

http://localhost:3716/web.Demo/Jquery_Tutorials.aspx?user=satalaj&lastName=More

protected void Page_Load(object sender, EventArgs e)
   {
     string currentPageURLis = Request.Url.ToString();
     
     Response.Write("Fully qualified Current Page URL is: " + currentPageURLis);
     
     Response.Write("<br/>");
     
     
     string absoluteUri  = Request.Url.AbsoluteUri;
     Response.Write("Absolute uri is: " + absoluteUri);
     
     Response.Write("<br/>");
     
     string queryString = Request.Url.Query;
     
     Response.Write("Query String Is: " + queryString);
     
   }

Output

Fully qualified Current Page URL is: http://localhost:3716/web.Demo/Jquery_Tutorials.aspx?user=satalaj&lastName=More
Absolute uri is: http://localhost:3716/web.Demo/Jquery_Tutorials.aspx?user=satalaj&lastName=More
Query String Is: ?user=satalaj&lastName=More 

Description:

Request.Url.Tostring() returns fully qualified URL of requested page.

Request.Url.AbsoluteUri property returns absolute url (exclude domain name).

Request.Url.Query property returns all query string parameters as string.

Tags:

How to Pass To Query String In Asp.netAsp.net Urldecode QueryStringAsp.net Convert String To ImageC# DateTime ToString()Jquery Trim Stringasp net image upload.net String vs stringJquery Get Target Of EventAsp.net UrlPathEncodeASp.net 2.0 step by step Membership Provider How to get Jquery selected option

Author

My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in ASP.net year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.
 

I'm Satalaj.