您的位置:首页 > 产品设计 > UI/UE

Request对象的使用

2007-05-16 14:51 337 查看
出自:http://www.51fy.cn/web/ASPNET/200705/33085.html

Response.Write("客户端的操作系统:" + Request.Browser.Platform + "<br>"); // WinNT

Response.Write("客户端用的浏览器:" + Request.Browser.Browser + "<br>"); // IE

Response.Write("客户端浏览器的版本:" + Request.Browser.Version + "<br>"); // 6.0

Response.Write("客户端FrameWork的版本:" + Request.Browser.ClrVersion.ToString()+"<br>"); // 2.0.50727

Response.Write("客户端浏览器是否有后退按钮:" + Request.Browser.HasBackButton.ToString()+"<br>"); // True

Response.Write("判断客户端浏览器类型:" + Request.Browser.IsBrowser("IE").ToString () + "<br>"); // True (大小写没差别)

Response.Write("判断客户端是几位机:" + ((Request.Browser.Win16==true)? "16位机":"32位机") + "<br>"); // 32位机

//Response.Write(""+Request.ContentEncoding.EncodingName+"<br>");

Response.Write("ApplicationPath应用程序根路径: " + Request.ApplicationPath + "<br>"); // /study1

Response.Write("AppRelativeCurrentExecutionFilePath应用程序根虚拟路径: " + Request.AppRelativeCurrentExecutionFilePath + "<br>"); // ~/Default.aspx

Response.Write("CurrentExecutionFilePath当前请求的虚拟路径: " + Request.CurrentExecutionFilePath + "<br>"); // /study1/textPath/path.aspx

Response.Write("AppDomain.CurrentDomain.BaseDirectory 获取基目录: " + AppDomain.CurrentDomain.BaseDirectory + "<br>"); // C:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005

Response.Write("原始URL地址(包括URL的参数)Request.RawUrl" + Request.RawUrl+"<br>"); // /study1/Default3.aspx?type=dddd

Response.Write("物理文件路径PhysicalPath:" + Request.PhysicalPath + "<br>"); // C:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesstudy1Default3.aspx

Response.Write("应用程序根目录物理文件路径PhysicalApplicationPath:" + Request.PhysicalApplicationPath + "<br>"); // C:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesstudy1

Response.Write("程序集路径:AppDomain.CurrentDomain.RelativeSearchPath" + AppDomain.CurrentDomain.RelativeSearchPath + "<br>"); // C:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesstudy1in

Response.Write("虚拟路径对应的物理路径Server.MapPath " + Server.MapPath("Default3.aspx") + "<br>"); //C:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesstudy1Default3.aspx

Response.Write("获取绝对的URI:Request.Url.AbsoluteUri" + Request.Url.AbsoluteUri.ToString()+"<br>"); // http://localhost:1035/study1/Default3.aspx?type=dddd

Response.Write("获取主机名:端口号" + Request.Url.Authority + "<br>"); // localhost:1035

Request.SaveAs(Request.PhysicalApplicationPath + "abc.xml", true);//保存
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: