access URL of application From which WEBAPI Controller is invoked

2

(In order to Enlarge images Please Right Click and Open images in New Tab)

 

c2

 

 
//If you want access application URL in WEBAPI Controller below line gives us Api URL

baseUrl = (Url.Request.RequestUri.GetComponents( UriComponents.SchemeAndServer, UriFormat.Unescaped).TrimEnd(‘/’) + HttpContext.Current.Request.ApplicationPath).TrimEnd(‘/’);

 

//If you want access URL of application From which WEBAPI  Controller is invoked below line gives us this URL

baseUrl = HttpContext.Current.Request.UrlReferrer.AbsoluteUri;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s