源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

获取当前url

  • 时间:2021-03-02 22:18 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:获取当前url
如:http://localhost/newurl/WebForm1.aspx 1.方法document.URL(注意大小写) 结果是:http://localhost/newurl/WebForm1.aspx 2.HttpContext.Current.Request.Url.ToString(), 结果:http://localhost/newurl/WebForm1.aspx 3.HttpContext.Current.Request.Url.PathAndQuery; 结果:/newurl/WebForm1.aspx 备注: 如果当前URL为 http://localhost/search.aspx?user=tinyfool&tag=%BC%BC%CA%F5 通过HttpContext.Current.Request.Url.ToString()获取到的却是 http://localhost/search.aspx?user=tinyfool&tag=¼¼Êõ 这显然不对,怎么办?用HttpContext.Current.Request.Url.PathAndQuery好了,这个得到的正确的。:) 4.Javascript取url值  刚写的一个小实例.实际中使用还是蛮多的.
[Ctrl+A 全选 注:[url=http://www.1sucai.cn/article/23421.htm]如需引入外部Js需刷新才能执行[/url]]
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部