zoukankan      html  css  js  c++  java
  • 获取当前请求的URL的地址、参数、参数值、各种属性

     1  //URL: http://localhost:1897/User/Press/UserContent.aspx/9878?id=1#toc
     2             Request.ApplicationPath;    //结果: /
     3             Request.PhysicalPath;     //结果: D:ProjectsSolutionwebUserPressUserContent.aspx
     4             System.IO.Path.GetDirectoryName(Request.PhysicalPath);     //结果: D:ProjectsSolutionwebUserPress
     5             Request.PhysicalApplicationPath;     //结果: D:ProjectsSolutionweb
     6             System.IO.Path.GetFileName(Request.PhysicalPath);     //结果: UserContent.aspx
     7             Request.CurrentExecutionFilePath;     //结果: /User/Press/UserContent.aspx
     8             Request.FilePath;     //结果: /User/Press/UserContent.aspx
     9             Request.Path;     //结果: /User/Press/UserContent.aspx/9878
    10             Request.RawUrl;     //结果:l /User/Press/UserContent.aspx/9878?id=1
    11             Request.Url.AbsolutePath;     //结果: /User/Press/UserContent.aspx/9878
    12             Request.Url.AbsoluteUri;     //结果: http://localhost:1897/User/Press/UserContent.aspx/9878?id=1
    13             Request.Url.Scheme;   //结果: http
    14             Request.Url.Host;     //结果: localhost
    15             Request.Url.Port;     //结果: 1897
    16             Request.Url.Authority;      //结果:localhost:1897
    17             Request.Url.LocalPath;     //结果: /User/Press/UserContent.aspx/9878
    18             Request.PathInfo;     //结果: /9878
    19             Request.Url.PathAndQuery;     //结果: /User/Press/UserContent.aspx/9878?id=1
    20             Request.Url.Query; //结果: ?id=1
    View Code
  • 相关阅读:
    移动端rem屏幕设置
    封装ajax库,post请求
    获取浏览器url参数
    身份证验证
    jq封装插件
    页面分享功能,分享好友、朋友圈判断,用share_type做标记 这里用的是jweixin-1.3.2.js
    @RequestParam和@RequestBody区别
    400报错
    IDEA中用Maven构建SSM项目环境入门
    Eclipse搭建Spring开发环境
  • 原文地址:https://www.cnblogs.com/linJie1930906722/p/5227564.html
Copyright © 2011-2022 走看看