[Switch] MVC in the Controller to get the current View URL

ASP.NET General:

[1] Get the full url (protocol name + domain name + virtual directory name + file name + parameters)

string url=Request.Url.ToString();

[ 2] Get virtual directory name + page name + parameter:

string url=Request.RawUrl;

(or string url=Request.Url.PathAndQuery;)

[3]Get virtual directory name + page name:

string url=HttpContext.Current.Request.Url.AbsolutePath;

(or string Url= HttpContext.Current.Request.Path;)

[4]Get Domain Name:

string url=HttpContext.Current.Request.Url.Host;

[5]Get Parameters:

string url= HttpContext.Current.Request.Url.Query; 

[6]Get Port:

Request.Url.Port