In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how ASP.NET ashx written in the class library and call on the page, Xiaobian feel quite practical, so share to everyone to make a reference, I hope you can have some harvest after reading this article.
The operation of building Http Handler in class library is very simple, just add a normal class, and then paste the code in ashx almost exactly into this class. But pay attention to namespaces and class names, because we'll use them later.
Sample Handler:
The code is as follows:
namespace EdiBlog.Core.Web.HttpHandlers
{
using System;
using System.Web;
public class ExampleHandler : IHttpHandler
{
public bool IsReusable
{
get { return false; }
}
public void ProcessRequest(HttpContext context)
{
//Your own logic...
}
}
}
The logic of this handler is not important, you can define it yourself. The key point is to implement the members defined in the IsReusable and ProcessRequest interfaces.
Next we're going to register this handler in the web.config of the site. If you are using IIS7 and above and are using integration mode, configure it like this:
Under the system.webServer\handlers node, add:
Path is the path to access the handler, and the extension needs to be registered in iis. If you are using a virtual host like me and cannot manage IIS yourself, please do not use extensions that IIS does not support by default, such as abc.
Type takes two parameters, the first is the full name of the handler class, and the second is the name of the assembly.
Now we can access handler on the web page using ex.axd!
About "ASP.NET how to write ashx class library and call on the page" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.