• asp.net获取URL方法


    方法如下:

    Request.Url.ToString()获取完整url(协议名+域名+站点名+文件名+参数):https://localhost:44300/WebForm1.aspx?abc=123
    Request.RawUrl获取客户端请求的URL信息(不包括主机和端口):/WebForm1.aspx?abc=123
    Request.Url.AbsolutePath获取站点名+页面名:/WebForm1.aspx
    Request.Url.Host获取主机部分:localhost
    Request.Url.Query获取参数部分:?abc=123
    Request.ApplicationPath获取应用程序的虚拟应用程序根路径:/
    Request.CurrentExecutionFilePath获取当前请求的虚拟路径:/WebForm1.aspx
    Request.Path获取当前请求的虚拟路径:/WebForm1.aspx
    Request.PathInfo获取具有URL扩展名的资源的附加路径信息:
    Request.PhysicalPath获取与请求的URL相对应的物理文件系统路径:c:usersjimdocumentsvisual studio 2010ProjectsWebApplication3WebApplication3WebForm1.aspx
    Request.Url.LocalPath获取文件名的本地操作系统表示形式:/WebForm1.aspx
    Request.Url.AbsoluteUri获取绝对URL:https://localhost:44300/WebForm1.aspx?abc=123
    Request.ServerVariables.Get("Local_Addr")获取服务器IP:::1
    Request.Url.Port获取服务器端口:44300
    Request.Url.Scheme获取服务器协议头:https
  • 相关阅读:
    兼容ie6:zindex
    分割网址/链接/url变量
    JS:给select添加option选项
    如果用QQ邮箱订阅一个网站或博客?
    input无边框
    有些标签的innerHTML属性是只读的
    满屏透明层
    文本框光标不居中?
    PHP:json_decode解析JSON数据
    开放平台/API
  • 原文地址:https://www.cnblogs.com/EasonJim/p/6306196.html
Copyright © 2020-2023  润新知