得到当前地址栏的地址

guitarbar 2010-01-14 06:05:49
我现在的地址是:http://localhost/test/chi/view.aspx
这个地址是映射的地址,真实的地址是:http://localhost/default.aspx

我想得到映射的地址:http://localhost/test/chi/view.aspx

下面有一些方法,都获得的是真实的地址:
[color=#0000FF]Request.Url.AbsoluteUri;
HttpContext.Current.Request.Url.PathAndQuery;
JS也不成:
sb.Append("<script>\n");
sb.Append("var s=\"http://\" + window.location.host + window.location.pathname;");
sb.Append("document.write(s)");
sb.Append("</script>");
[/color]

那位兄弟帮帮忙吧,可能没分了,有的话都献出来,各位包涵

...全文
195 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Hertz_liu 2010-02-22
  • 打赏
  • 举报
回复
Request.Url.ToString()得不到吗?
guitarbar 2010-02-22
  • 打赏
  • 举报
回复
没有解决问题
up
wangping06 2010-01-15
  • 打赏
  • 举报
回复
up
wuyq11 2010-01-14
  • 打赏
  • 举报
回复
取当前地址
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.RawUrl: /testweb/default.aspx
Request.Url.AbsolutePath: /testweb/default.aspx
Request.Url.AbsoluteUri: http://www.test.com/testweb/default.aspx
Request.Url.Host: www.test.com
Request.Url.LocalPath: /testweb/default.aspx
如果使用urlrewrter通过规则获取
HarveyYan 2010-01-14
  • 打赏
  • 举报
回复
Request.RawUrl 行不?
Rock870210 2010-01-14
  • 打赏
  • 举报
回复
Context.Request.Url.ToString()不行吗?

62,254

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧