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。

  • 相关阅读:
    SQL 2008 TSQL(表变量参数) (转)
    当前主流浏览器并行连接数(同域名)
    ASP.NET 页生命周期概述
    使用SecureCRT连接ubuntu或者redhat
    Linux下查看CPU使用率
    在网上搜罗的一些有阀值的性能测试指标(转)
    httpModule测试
    狙击怪物还不错,O(∩_∩)O~
    IIS 5.0 和 6.0 的 ASP.NET 应用程序生命周期概述
    Sql Server 分区演练
  • 原文地址:https://www.cnblogs.com/bruce1992/p/14396895.html
Copyright © 2011-2022 走看看