dot net获取url已经提供了N多种函数,测试的url地址是http://weste.net/itnews/default.aspx,我们一个一个来测试一下,具体的测试用例和结果如下:
Request.ApplicationPath
结果:/itnews
Request.CurrentExecutionFilePath:
结果:itnews/default.aspx
Request.FilePath:
结果:/itnews/default.aspx
Request.Path:
结果:/itnews/default.aspx
Request.PhysicalApplicationPath:
结果:d:\wwwroot\itnews\
Request.PhysicalPath:
结果:d:\wwwroot\itnews\default.aspx
Request.RawUrl:
结果:/itnews/default.aspx
Request.Url.AbsolutePath:
结果:/itnews/default.aspx
Request.Url.AbsoluteUri:
结果:http://weste.net/itnews/default.aspx
Request.Url.Host:
结果:weste.net
Request.Url.LocalPath:
结果:/itnews/default.aspx
···
···