Monday, April 12, 2010

ASP.Net: Referencing root-relative paths (~/) in javascript

The “~/” specifies a root-relative path in ASP.Net. ASP.Net uses the ResolveUrl and ResolveClientUrl to determine the logical path that a path containing the “~/” points to.

If you need to use a root relative path from within a JavaScript method running within an ASP.Net page, then here is what the code looks like:

<script type="text/javascript">
    function OnSuccess() {

And here is a useful site with information on ASP.Net Paths -

No comments: