热门文章
javascript 操作treeview...
C#中如何获得屏幕宽度和高度
FCKeditor用法-含代码高...
FCKeditor 回车文字换行...
用VS制作证书的方法
C#导出EXCEl文件 C#导出w...
C#注册js脚本
AxWindowsMediaPlayer的...
FCKeditor上传文件时提示...
WebBrowser控件使用详解
获取网站根目录的url
C#创建Active控件并发布(一)
DataList1_ItemCommand
C#生成缩略图
获取URL
AxWindowsMediaPlayer
获取网站根目录的url
发布时间: 2010-09-27    被阅览数: 次    文字大小:〖

 

public static string GetRootURI()
    {
        string AppPath = "";
        HttpContext HttpCurrent = HttpContext.Current;
        HttpRequest Req;
        if (HttpCurrent != null)
        {
            Req = HttpCurrent.Request;
            string UrlAuthority = Req.Url.GetLeftPart(UriPartial.Authority);
            if (Req.ApplicationPath == null || Req.ApplicationPath == "/")
                //直接安装在   Web   站点  
                AppPath = UrlAuthority;
            else
                //安装在虚拟子目录下  
                AppPath = UrlAuthority + Req.ApplicationPath;
        }
        return AppPath;
    }
上一篇:C#生成缩略图
   下一篇:DotNetTextBox控件演示地址