Question

I have a C#.Net web app and the pathing is different from my local box to the dev box. My local url is http://localhost:<port>/Proposal/Edit. However, on the dev server, it is http://{MydevServer}/dev/app/Proposal/Edit]. So, this causes issues with the Style Sheet and navigation links, etc. I know I can grab the ApplicationPath inside all the Controllers and set a variable whic the pathed elements can use. But that seems like too much work for this issue. Any ideas on how to solve this? Is it possible to get the ApplicaionPath in the _Layout.cshhml file? Is ther a better idea?

Was it helpful?

Solution

you should be using the Url.Action and Url.Content helper methods for generating your links and src attributes. then you'll never need to worry about it.

OTHER TIPS

You can call Href("~/") in any Razor page to get the full client path to your application root.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top