获取应用程序的根Url

获取应用程序的根Url

 

 

 VB代码
    Public Function ApplicationRootUrl() As String
        
Dim req As HttpRequest = HttpContext.Current.Request
        
Return req.Url.GetLeftPart(System.UriPartial.Authority) + req.ApplicationPath & "/"
    
End Function

    
'调用方式如下:
    ApplicationRootUrl() & "prg/if/ifShowMsgAddUp.aspx"
    
    
'结果:http://localhost:8010/iOffice/prg/if/ifShowMsgAddUp.aspx


 

 

posted @ 2011-02-21 18:22  Felix Liang  阅读(642)  评论(0编辑  收藏  举报