首页 > 数据库技术 > 详细

html执行.NET函数 html操作数据库 html与ashx结合

时间:2017-07-13 09:37:37      阅读:292      评论:0      收藏:0      [点我收藏+]

原文发布时间为:2009-09-30 —— 来源于本人的百度文章 [由搬家工具导入]

html页面执行.NET函数 html与ashx的结合

1、添加一般应用程序Handler.ashx

<%@ WebHandler Language="C#" Class="Handler" %>

using System;
using System.Web;

public class Handler : IHttpHandler {
   
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        context.Response.Write("document.write(\"Hello World\")");
    }

    public bool IsReusable {
        get {
            return false;
        }
    }

}

2、添加html页面 HTMLPage.htm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<script type="text/javascript" src="/ajax/AjaxHandler"></script>
    <title>无标题页</title>
</head>
<body>
<script type="text/javascript" src="ASHX/Handler.ashx"></script>
</body>
</html>

执行html,则将看到 “Hello World”

操作数据库 方法同上(见http://hi.baidu.com/handboy/blog/item/453bcbf40ff650d3f2d38501.html)! 只是程序变化。命名空间注意一下即可。

html执行.NET函数 html操作数据库 html与ashx结合

原文:http://www.cnblogs.com/handboy/p/7158359.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!