Can I resolve ASP.NET "~" app paths to the website root without a Control being present?

Posted by jdk on Stack Overflow See other posts from Stack Overflow or by jdk
Published on 2010-04-07T01:57:43Z Indexed on 2010/04/07 2:23 UTC
Read the original article Hit count: 323

Filed under:
|

I want to Resolve "~/whatever" from inside non-Page contexts such as Global.asax (HttpApplication), HttpModule, HttpHandler, etc. but can only find the Resolution methods specific to Controls (and Page).

I think the app should have enough knowledge to be able to map this outside the Page context. No? Or at least it makes sense to me it should be resolvable in other circumstances, wherever the app root is known.

Update: The reason being I'm sticking ~ paths in the web.configuration files.

Update 2: I'm trying to resolve them to the website root such as Control.Resolve(..) URL does, not to a file system path.

© Stack Overflow or respective owner

Related posts about asp.net-2.0

Related posts about resolveurl