zoukankan      html  css  js  c++  java
  • 在ASP.NET MVC 框架中调用 html文件及解析get请求中的参数值

      在ASP.NET MVC 框架中调用 html文件:

        public ActionResult Index()
        {
          using (StreamReader sr = new StreamReader(Path.Combine(HttpRuntime.AppDomainAppPath,"index.html")))
          {
            String htmlContent = sr.ReadToEnd();
            return Content(htmlContent);
          }
        }

    扩展:

      如果要调用的html文件是网站的首页(即index.html),其实还有另一些实现方法,比如在global.asax文件中加入以下代码(需要重新编译、发布):

        protected void Application_BeginRequest(object sender, EventArgs e)
        {
          if (Context.Request.FilePath == "/") Context.RewritePath("index.html");
        }

      扩展内容参考于:http://blog.sina.com.cn/s/blog_64008ed70101nnfb.html

    二、

      解析 get 请求中的参数值(之前在处理微信公众号的时候需要返回微信发起的一个get请求中的一个参数)

        public void WXtext()
        {
          Response.ContentType = "text/plain";
          string echostr = Request.QueryString["echostr"];
    
    
          Response.Write(echostr);
        }
  • 相关阅读:
    c++ Knight Moves 超级升级版
    百度招聘彩蛋
    C++ 八数码问题宽搜
    c++ 动态规划(数塔)
    c++ 深度优先搜索(迷宫)
    c++ 宽搜(倒水)
    c++ matrix逆时针螺旋
    c++ 基数排序
    c++ 二分答案(解方程)
    c++ 二分答案(数组查找)
  • 原文地址:https://www.cnblogs.com/zhangchaoran/p/8036015.html
Copyright © 2011-2022 走看看