zoukankan      html  css  js  c++  java
  • C# 一般处理程序

    public class Three : IHttpHandler{
            public void ProcessRequest(HttpContext context)
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write("Hello World");
                context.Response.Write("sss");
            } 
        }
    复制代码
    复制代码
    public void ProcessRequest (HttpContext context) {     请求过来找到该一般处理程序文件,自动执行ProcessRequest方法。
            context.Response.ContentType = "text/html";
            //获取要操作的模板的路径.
            string filePath = context.Request.MapPath("ShowInfo.html");//获取文件的物理路径。在Asp.net中,对文件或文件夹进行操作一定要获取物理路径。
            //读取模板文件中的内容。
           string fileContent=File.ReadAllText(filePath);
            //用户具体的数据替换模板文件中的展位符。
           fileContent = fileContent.Replace("$name","itcast").Replace("$pwd","123");
            //将替换后的内容输出给浏览器。
           context.Response.Write(fileContent);
           context.Response.Write("<b>adfsdf</b>");

        context.Response.Write(System.Reflection.Assembly.GetExecutingAssembly().Location); }
    复制代码
    复制代码
    $(function () {
                $(".deletes").click(function () {
                    if (!confirm("确定要删除吗?")) {
                        return false;
                    }
                });
            });
    复制代码
    string userName=context.Request.QueryString["txtName"];//接收的是表单元素name属性的值
    string userPwd=context.Request.QueryString["txtPwd"];
    string userName = context.Request.Form["txtName"];
    string userPwd = context.Request.Form["txtPwd"];

    IIS会根据请求的文件类型进行判断,如果发现浏览器请求的是动态文件(ashx) IIS是处理

    不了的,会将请求的文件交给.netframework来执行,IIS是通过aspnet.isapi.dll来把请求的

    动态文件交给.netframework。

  • 相关阅读:
    安装VMtools vim编辑器的使用 压缩包命令 Linux下的用户管理 (第三天)
    VM虚拟机安装 常用Linux命令 网卡配置 (第二天)
    数据库的交互模式 常用的dos命令 (第一天)
    Validate US Telephone Numbers FreeCodeCamp
    Arguments Optional FreeCodeCamp
    Everything Be True FreeCodeCamp
    Binary Agents FreeCodeCamp
    Steamroller FreeCodeCamp
    Drop it FreeCodeCamp
    Smallest Common Multiple FreeCodeCamp
  • 原文地址:https://www.cnblogs.com/bruce1992/p/14396895.html
Copyright © 2011-2022 走看看