0

My ASP.NET web app is deployed into a location like https://server/path1/path2.

How can I get in the C# code that path, where the app is running?

JamesL
  • 351
  • 2
  • 10

1 Answers1

0

This should work:

        string baseURL2 = 
         Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.UriEscaped);

        Debug.Print(baseURL2);

It does not include a trailing "/"

Edit: sorry, I see this is for MVC, so, I can't suggest if above will work. Above was for webforms.

Albert D. Kallal
  • 42,205
  • 3
  • 34
  • 51