从内容页面asp.net调用通用处理程序 [英] Calling generic handler from content page asp.net

查看:95
本文介绍了从内容页面asp.net调用通用处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ASP.Net开发了带有表单的母版页.
现在,我开发了带有表单的内容页面.在提交内容页面表单按钮时,我要调用通用处理程序.我怎样才能做到这一点????简而言之,这个处理程序不会被调用.
我无法通过表单操作客栈母版页,因为这会影响其他页面.
Wen我只是简单地开发了一个页面,而没有dis母版页den代码可以正常工作.
[edit]已删除呼喊声-OriginalGriff [/edit]

Using ASP.Net, i''hv developed a master page with a form.
Now, i developed a content page with a form. On submit of content page form button i wana call a generic handler. How can i do this???? Wen a simply do this handler is not called.
I cant pass form action inn master page as this affecting other pages.
Wen i simply developed a page without dis master page den code workin fine.

[edit]SHOUTING removed - OriginalGriff[/edit]

推荐答案

首先在您的项目中添加通用处理程序.

通用处理程序是实现System.Web.IHttpHandler接口的.NET组件.任何实现IHttpHandler接口的类都可以充当传入HTTP请求的目标.页面也是通用处理程序.通常,通用处理程序具有ASHX的扩展名.
然后,在处理程序中编写一个函数,您可以在其中指定要提交的内容.喜欢

//示例
私有无效CheckRequisitionNo()
{
字符串refSourceString = String.Empty;
字符串RN = HttpContext.Current.Request.QueryString ["rn"];

//根据您的要求编写代码
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType =文本/纯文本";
HttpContext.Current.Response.Write(refSourceString);
HttpContext.Current.Response.Flush();
}

然后,从客户端调用该函数.

喜欢:
DataHandler.ashx?CallMode = CheckRequisitionNo&ItemCode =''+
At first add a Generic handler in your project.

Generic handlers are the .NET components that implement the System.Web.IHttpHandler interface. Any class that implements the IHttpHandler interface can act as a target for the incoming HTTP requests. Page is also generic handler. In general generic handlers have an extension of ASHX.

Then, In the handler write a function in which you specify what do you want do on submit. like

//Example
private void CheckRequisitionNo()
{
String refSourceString = String.Empty;
String RN = HttpContext.Current.Request.QueryString["rn"];

//Write the code as per your requirements
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "text/plain";
HttpContext.Current.Response.Write(refSourceString);
HttpContext.Current.Response.Flush();
}

Then , call the function from client side.

Like:
DataHandler.ashx?CallMode=CheckRequisitionNo&ItemCode='' +


这篇关于从内容页面asp.net调用通用处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆