Skip to main content

Posts

Showing posts with the label httphandlers

ASP.NET HttpHandler how to

HttpHandlers are class which extend HttpHandler and which IIS recognises as the classes to use to handle errors etc. The HttpHandler class is usually stored inside a .ashx file. You can create your on .ashx and place it in you web app root dir, it will be entered whenever a request comes in from the client. If you do not want to show your HttpHandler file code in your web app then you can hide it in a dll see details below. How to hide the . ashx with a HttpHandler I'll describe here how to create a handler for a file with the extension .ashx, it's coincidental I require a HttpHandler in my web.config in order to alias my .ashx file which is too a HttpHandler. Note: Before you can compile a HttpHandler into a dll you must remove the directive at the start of the .ashx file e.g. delete this line <%@ WebHandler Language="C#" Class="MyWebHandler" %> If you fail to do this your .ashx code will not appear in your dll and you will not be able t...

WebServices

Webservices are exposed methods which can be accessed through a uri e.g.your code is contained in a .asmx file. The .asmx file contains webmethods (ordinary methods with the [WebMethod] attribute). You place your .asmx file inside your webserver somewhere and these can be consumed directly by browsing to the uri or by consuming the webservice by adding it as a reference to your application and then accessing that reference. Webservices can also be created with Codebehind meaning the code itself is in another file, this results in the .asmx file just containing a Directive to the class name containing the webmethod, to use this webservice the codebehind dll must be placed within the websites bin directory. The WebService works by the Client and Server sending SOAP XML (SOAP is just the root element, it's something that Internet Explorer knows how to parse) up and down over HTTP. Both sides need to know how to create this SOAP XML, on the Client side this is done by a Proxy class whi...

ASP.NET, terms, filetypes, examples

http://feeds.delicious.com/rss/learnerplates/httpmodule http://feeds.delicious.com/rss/learnerplates/httphandler ASP.NET is the .NET version of ASP, this new version adds more functionality. ASP and ASP.NET are web development frameworks which allow you the developer to access and manipulate HTML before Posting it up to the client. Both frameworks allow you to access HTML controls (e.g. TextField) using the directive "script runat="server"" . This gives you a reference to the HTML control, that the user sees in their browser, from the server side. You also have control over the Http Requests and Responses, allowing you to analyze responses sent back, errors and cookies etc can be transmitted over HTTP. ASP was lacking in that you could not separate the scripting logic from the HTML front end of the file. ASP.NET allows you to move your logic (written in any .NET language) to a separate file, this is referred to as CodeBehind. The codebehind can be accessed in the as...