zoukankan      html  css  js  c++  java
  • 页面请求相关

    以下记录一下,方便以后查阅。。。

    Request下获取Url所有相关属性 Request的RawUrl属性,和其它获取url信息的各种方法比较 测试的url地址是http:
    //www.cnblogs.com/dachie/default.aspx?id=1, 结果如下: Request.ApplicationPath: /dachie Request.CurrentExecutionFilePath: /dachie/default.aspx Request.FilePath: /dachie/default.aspx Request.Path: /dachie/default.aspx Request.PathInfo: Request.PhysicalApplicationPath: E:\WWW\testweb\ Request.PhysicalPath: E:\WWW\dachie\default.aspx Request.RawUrl: /dachie/default.aspx?id=1 Request.Url.AbsolutePath: /dachie/default.aspx Request.Url.AbsoluteUri: http://www.cnblogs.com/dachie/default.aspx?id=1 Request.Url.Host: www.cnblogs.com Request.Url.LocalPath: /dachie/default.aspx
         获取请求的IP地址
            public static string GetRequestIP()
            {
                string result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (string.IsNullOrEmpty(result))
                {
                    result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                }
                if (string.IsNullOrEmpty(result))
                {
                    result = HttpContext.Current.Request.UserHostAddress;
    
                }
                return result;
            }
    页面后台向前台输出脚本
    if (!Page.ClientScript.IsStartupScriptRegistered("preview"))
    {
        Page.ClientScript.RegisterStartupScript(GetType(), "preview", "window.open('" + BOManager.CMSTempletBO.CreateContent(CMSTempletBO.PageType.Preview, entity) + "');", true);
    }

    Request下获取Url所有相关属性

    Request的RawUrl属性,和其它获取url信息的各种方法比较

    测试的url地址是http://www.cnblogs.com/dachie/default.aspx?id=1, 结果如下:

    Request.ApplicationPath: /dachie

    Request.CurrentExecutionFilePath: /dachie/default.aspx

    Request.FilePath: /dachie/default.aspx

    Request.Path: /dachie/default.aspx

    Request.PathInfo:

    Request.PhysicalApplicationPath: E:\WWW\testweb\

    Request.PhysicalPath: E:\WWW\dachie\default.aspx

    Request.RawUrl: /dachie/default.aspx?id=1

    Request.Url.AbsolutePath: /dachie/default.aspx

    Request.Url.AbsoluteUri: http://www.cnblogs.com/dachie/default.aspx?id=1

    Request.Url.Host: www.cnblogs.com

    Request.Url.LocalPath: /dachie/default.aspx

  • 相关阅读:
    免费webservice接口
    sql server按符号截取字符串
    javaweb项目部署到tomcat服务器
    sql server导出数据结构
    Mabits简单应用 2017.8.3
    部署项目到tomcat步骤参考如下 2017.7.10
    没事多看文档 2017.7.8
    ssh商城源码 2017.6.30
    axios的详细用法以及后端接口代理
    用Vue来实现音乐播放器(八):自动轮播图啊
  • 原文地址:https://www.cnblogs.com/zhangchen/p/2498906.html
Copyright © 2011-2022 走看看