用特殊符号~标示
1./表示网站根目录,../表示上级目录,./表示当前目录。
2.HTTP://WWW.BAIDU.COM/document/1.aspx
1.如果在服务器控件中使用虚路径会将~进行转换。
2.VirtualPathUtility
•String ToAbsolute(“~”)
•String Combine( string base pash,string relative path)
•AppendTrailingSlash(“”)
•String GetDirectory(string virtpath)返回虚拟路径的目录部分。
•String MakeRelative(string formPath,string topath)计算两个虚拟路径的相对路径。
Request对象
•AppRelativeCurrentExecutionFilePath返回string类型的当前执行的请求相对于应用根目录的虚拟路径,提示以~,比如~/request/requestDemo1.aspx
•PhysicalPath
•RawUrl 获得原始请求的URL
•Url获得请求的URL
•UrlReferrer:获取网页来源,---http---防止盗链。-----验证码?----本质是代码的图片---程序画出来的。-----aspx运行c#---画图。(Ashx用它来生成)
•UserHostAddress
•Cookies---Request.Cookies[“mysessionid”]-------获取浏览器发过来的浏览器端的cookie,从中读取cookie的值。
•UserLanguage获得访问者浏览器支持的语言,通过这个可以实现对不同语言的浏览器,显示不同语言的界面。
•Request.MapPath(virtulPath)将虚拟路径转换为磁盘上的物理路径。
•Server.MapPath()
Response对象
Response对象成员:
•
Buffer:
•
BufferOutPut
•
Flush()将缓存区的数据发给浏览器。这个对于每次都要把respose.write()中的内容发给浏览的需求很适用。
•
Clear()清空缓存区数据,这样缓存区中就没有要发送到浏览器中的数据了。
•
ContentEncoding
•
contentType:输出内容的类型