Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
How to get url of current page in c# in C# Syntax of C#
16143 Views
Syntax
	string url = HttpContext.Current.Request.Url.AbsoluteUri;
	// http://localhost:1002/About/Home.aspx?query=1&query=2
	
	string path = HttpContext.Current.Request.Url.AbsolutePath;
	// /About/Home.aspx
	
	string host = HttpContext.Current.Request.Url.Host;
	// localhost
	
	string hostWithPortNumber = HttpContext.Current.Request.Url.Authority;
	// localhost:1002
	
	string host = HttpContext.Current.Request.ApplicationPath);
	// /About
	
	string host = HttpContext.Current.Request.Url.PathAndQuery);
	/About/Home.aspx?query=1&query=2
Previous Topics
Previous lessons of current book.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details