2

I wanting to know if at all possible, if can I override what the tilde (~) resolves to in a razor view page.

For example

<link type="text/css" rel="stylesheet" href="~/Content/Site.css">

Is there somewhere that I can override what the tilde resolves too? I have a custom view engine and base view page but cant seem to find it!

Thanks in advance!

Edit

I have content e.g. css and images stored with seperate folders for modules. The views that are being rendered belong to a module so I would like ~ to resolve to the modules content folder rather than the host.

I already know the paths for my modules etc, I just want to be able to change the ~ from resolving to /, to resolve to /Modules/ModuleName/.

Richard Adnams
  • 3,128
  • 2
  • 22
  • 30
  • What do you want to override it to? `~` means the "application root". – gunr2171 Aug 04 '14 at 14:04
  • Related: http://stackoverflow.com/questions/4563235/where-does-asp-net-virtual-path-resolve-the-tilde?rq=1 – gunr2171 Aug 04 '14 at 14:05
  • I have content e.g. css and images stored with seperate folders for modules. The views that are being rendered belong to a module so I would like ~ to resolve to the modules content folder rather than the host. – Richard Adnams Aug 04 '14 at 14:06
  • 1
    Can you post an example, like a simple folder tree of what you have? – gunr2171 Aug 04 '14 at 14:07
  • If you already know the path to the module, why not use `~/ModulePath/ResourseInside`? So in your case, `~/Modules/ModuleName/...`. – gunr2171 Aug 04 '14 at 14:11
  • The views are held inside the module, so I would find it neater to just write ~/Content/.., I've already sorted the @Url.Content and other similar methods. – Richard Adnams Aug 04 '14 at 14:14

0 Answers0