Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application Root in MVC App?

I am having some problems with an MVC app that uses logic based off data driven URLs (for routing) if my application is deployed to anywhere else other than the domain root.

I tried using various Request.Url properties to no avail.

Let's say I deploy my app to www.mydomain.com/myapp/ or even www.mydomain.com/myapp/subapp/. In these cases how can I get /myapp/ and /myapp/subapp/ respectively. Even if the user is on a totally different page such as /myapp/Users/Recent/?

I need that so I can prefix all the data driven URLs so my app still works when not on the domain root.

Thanks.

like image 847
SventoryMang Avatar asked Dec 27 '22 20:12

SventoryMang


1 Answers

You're looking for HttpRuntime.AppDomainAppVirtualPath.

Note that all of the Url.* helpers will do this for you.

like image 103
SLaks Avatar answered Jan 12 '23 00:01

SLaks