html中怎么利用ashx实现表单提交-创新互联
今天就跟大家聊聊有关html中怎么利用ashx实现表单提交,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
1,sumbit表单提交
WebForm1.aspx源码:
复制代码 代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="NETFormDemo.ashx.WebForm1" %>
submitForm.ashx源码:
复制代码 代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace NETFormDemo.ashx
{
///
/// submitForm 的摘要说明
///
public class submitForm : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
2,ajax提交
HtmlPage1.html 源码:
复制代码 代码如下:
add.ashx源码:
复制代码 代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace NETFormDemo.ashx
{
///
/// Login 的摘要说明
///
public class Login : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
int first = Convert.ToInt32(context.Request.Params["i"]);
int sec = Convert.ToInt32(context.Request.Params["j"]);
int res = first + sec;
context.Response.Write(res);
context.Response.Write("fdd ff");
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
看完上述内容,你们对html中怎么利用ashx实现表单提交有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联行业资讯频道,感谢大家的支持。
新闻名称:html中怎么利用ashx实现表单提交-创新互联
URL网址:http://azwzsj.com/article/dhijsh.html