惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News and Events Feed by Topic
爱范儿
爱范儿
Blog — PlanetScale
Blog — PlanetScale
The GitHub Blog
The GitHub Blog
C
Check Point Blog
小众软件
小众软件
I
InfoQ
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Engineering at Meta
Engineering at Meta
酷 壳 – CoolShell
酷 壳 – CoolShell
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Hugging Face - Blog
Hugging Face - Blog
博客园 - 三生石上(FineUI控件)
MyScale Blog
MyScale Blog
The Cloudflare Blog
Last Week in AI
Last Week in AI
腾讯CDC
Y
Y Combinator Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
雷峰网
雷峰网
B
Blog
T
Tailwind CSS Blog
MongoDB | Blog
MongoDB | Blog
A
About on SuperTechFans
D
Docker
博客园 - 司徒正美
博客园_首页
Recent Announcements
Recent Announcements
D
DataBreaches.Net
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
Google Developers Blog
Microsoft Security Blog
Microsoft Security Blog
F
Fortinet All Blogs
Stack Overflow Blog
Stack Overflow Blog
aimingoo的专栏
aimingoo的专栏
N
Netflix TechBlog - Medium
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东
GbyAI
GbyAI
Jina AI
Jina AI
V
V2EX
Vercel News
Vercel News
IT之家
IT之家
WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
NISL@THU
NISL@THU
V
Visual Studio Blog
C
Cybersecurity and Infrastructure Security Agency CISA

博客园 - 恋地高飞

超级弹窗代码(P2P,360都拦截不了 sql批量修改表名(前缀)--亲测 baset64加密解密代码 com/c.js木马攻击...(转) asp.net TextBox显示密码 - 恋地高飞 - 博客园 Ext.Window窗口下onclick="Button1_Click",不能提交的问题 IIS7 中使用 UrlRewritingNet(转) Reflector使用手记 学习SQL Server全文索引 (转 ) 查询同一表内多字段同时重复记录的SQL语句 asp.net中Excel导入(使用微软OLEDB驱动) 警告: 程序集绑定日志记录被关闭。 Repeater1绑定数据,编辑数据的一些参考文章 asp.net下linkbutton的前后台使用方法 sqlserver 中判断是否数字,是否汉字的方法 301永久重定向asp.net实现方法 Net程序如何防止被注入 UrlRewritingNet 完美实现 ASP.NET 2.0 中的URL重写(映射) (转) FusionCharts一款flash统计控件,可以用于C#
asp.net获取URL和IP地址
恋地高飞 · 2009-02-04 · via 博客园 - 恋地高飞

HttpContext.Current.Request.Url.ToString() 并不可靠。

如果当前URL为
http:
//localhost/search.aspx?user=http://csharp.xdowns.com&tag=%BC%BC%CA%F5

通过HttpContext.Current.Request.Url.ToString()获取到的却是

http:
//localhost/search.aspxuser=http://csharp.xdowns.com&tag=¼¼Êõ


正确的方法是:HttpContext.Current.Request.Url.PathAndQuery

1、通过ASP.NET获取
如果测试的url地址是http:
//www.test.com/testweb/default.aspx, 结果如下:
Request.ApplicationPath:                /testweb
Request.CurrentExecutionFilePath:       
/testweb/default.aspx
Request.FilePath:                       
/testweb/default.aspx
Request.Path:                           
/testweb/default.aspx
Request.PhysicalApplicationPath:         E:\WWW\testwebRequest.PhysicalPath:                    E:\WWW\testweb\
default.aspx
Request.RawUrl:                         
/testweb/default.aspx
Request.Url.AbsolutePath:               
/testweb/default.aspx
Request.Url.AbsoluteUrl:                 http:
//www.test.com/testweb/default.aspx
Request.Url.Host:                        www.test.com
Request.Url.LocalPath:                  
/testweb/default.aspx

posted on 2009-02-04 14:41  恋地高飞  阅读(381)  评论(0)    收藏  举报

刷新页面返回顶部

导航