Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I've created an ashx handler inside a Class project - heres the structure
Class Project > Service > MyHandler.ashx
Service = folder and MyHandler.ashx is an ashx file with some code.
I would like to be able to visit this ashx from a browser using the URL http://localhost/handlers/myhandler.ashx
I created a node within umbraco but not sure how i register the handler and create the above URL?
Hi J
If you create the .ashx in your website project, then the handler will be hit if you request the path to that file, without configuration.
The logic/code the handler then executes could then be called from the class library project
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Write("Hello World"); var mycustomservice = new MyClassLibrary.SuperDoSomethingService(); var stuff = mycustomservice.DoOrGetSomething(); //etc }
With regards to handlers, I am not sure what you exactly mean with "I created a node within Umbraco".
In order to call your .ashx handler, Umbraco should not process your handlers path the default way (searching for a content node).
To prevent Umbraco processing that path, you need to add it to the umbracoReservedPath in the web.config file:
<appSettings> <add key="umbracoReservedPaths" value="~/umbraco,~/install/,~/handlers/" /> ...
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to configure ashx
I've created an ashx handler inside a Class project - heres the structure
Class Project > Service > MyHandler.ashx
Service = folder and MyHandler.ashx is an ashx file with some code.
I would like to be able to visit this ashx from a browser using the URL http://localhost/handlers/myhandler.ashx
I created a node within umbraco but not sure how i register the handler and create the above URL?
Hi J
If you create the .ashx in your website project, then the handler will be hit if you request the path to that file, without configuration.
The logic/code the handler then executes could then be called from the class library project
With regards to handlers, I am not sure what you exactly mean with "I created a node within Umbraco".
In order to call your .ashx handler, Umbraco should not process your handlers path the default way (searching for a content node).
To prevent Umbraco processing that path, you need to add it to the umbracoReservedPath in the web.config file:
is working on a reply...