Application Root

Results 1 to 2 of 2

Thread: Application Root

  1. #1
    Join Date
    Dec 1969

    Default Application Root

    I&#039;ve been pulling my hair out over this!!<BR><BR>is there any way to discover the Application Path (i.e Virtual root) that an aspx is running in?<BR><BR>example, myapp is the vroot in both:<BR><BR>http://localhost/myapp/myfolder/mypage.aspx<BR><BR>but you could also have<BR><BR>http://localhost/myfolder/myapp/myfolder/mypage.aspx<BR><BR>when deployed these both become<BR><BR><BR><BR><BR>does a page have any concept of the application it&#039;s running in?<BR><BR>cheers<BR>c<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Application Root

    there&#039;s a property of the "Request" object<BR><BR>[code language="VB.NET"]Request.ApplicationPath[/code]<BR><BR>so instead of having "/myapp/" hardcoded in your images/links/etc, use the above instead<BR><BR>for stuff like user controls and declarations, use the "~" (which means application root, but this only works for .NET stuff)<BR><BR>for instance:<BR>[code language="VB.NET"]&#060;%@ Register TagPrefix="Layout" TagName="Menu" Src="~/application/!menu.ascx" %&#062;[/code]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts