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。

  • 相关阅读:
    【每日scrum】5.3
    Scrum仪式之Sprint计划会议
    软工结队开发--成员介绍
    java反射保存
    java后台开发传输乱码&&接口post传参失败
    润乾报表之分组
    润乾报表之居中无效(去空格)
    润乾报表之日期格式、小数位数
    润乾报表之序号、固定行数、统计
    润乾报表之条形码
  • 原文地址:https://www.cnblogs.com/bruce1992/p/14396895.html
Copyright © 2011-2022 走看看