[home]
[scripts]
[news]
[forums]
[feedback]
...a journey into a lost mind. Don't suppose you found it?
Get Application Root Path
(id:
1503
) (
3912
hits)
Description:
This is a simple function I include in most of my apps, typically in a BasePage or BaseControl but you could easily put it in a Utility type class. What it does is return the current root for your site. This is kind of the equivalent of the "~/" in Asp.Net but it takes into account for ports, etc. Even if you use the File based websites (and get a site like http://localhost:12345/siteName it will return the root property ("http://localhost:12345")
Code:
Public Shared ReadOnly Property UrlBase() As String
Get
Dim _return As String = ""
If HttpContext.Current.Request.Url.Port = 80 Then
_return = "http://" & HttpContext.Current.Request.Url.Host & HttpContext.Current.Request.ApplicationPath
Else
_return = "http://" & HttpContext.Current.Request.Url.Host & ":" & HttpContext.Current.Request.Url.Port & HttpContext.Current.Request.ApplicationPath
End If
If _return.EndsWith("/") Then
_return = _return.Substring(0, _return.Length - 1)
End If
Return _return
End Get
End Property
Created:
8/22/2007 7:31:00 AM
Created By:
Curt
Download URL:
Category:
ASP.NET/VB.Net
Sample URL:
Updated:
2:00:00 AM
Most Popular Scripts
(9731 hits)
File Uploads
[3/18/2002][ASP/VBScript]
(7274 hits)
WAIT message
[4/5/2002][ASP/VBScript]
(6688 hits)
Calendar Script
[3/18/2002][ASP/VBScript]
(6437 hits)
Tree/Forum Script
[4/2/2002][ASP/VBScript]
(5981 hits)
NT Authentication
[11/12/2002][ASP/VBScript]
Newest Scripts
Get Application Root Path
[8/22/2007][ASP.NET/VB.Net]
Who Is Online.
[6/27/2007][ASP.NET/VB.Net]
Save a remote file
[6/23/2007][ASP.NET/C#]
ITracker - Sample Application
[9/13/2006][ASP.NET/VB.Net]
How to start/stop a service
[12/5/2005][ASP.NET/C#]
RSS Subscriptions
News
Newest Scripts
Top Scripts
Newest Posts
Advanced Script Search
Keyword(s)
Any
ASP/JScript
Visual Basic 6
ASP/VBScript
HTML
Javascript
ASP.NET/C#
ASP.NET/VB.Net
ASP.NET/General
Category
Searching...