Last post May 04, 2006 02:09 AM by email@example.com
Apr 28, 2006 01:06 PMfirstname.lastname@example.org|LINK
I wrote myhandler.ashx and I'm succesfully using ( /myapp/myhandler.ashx/requestparam) it without any additional steps.
Today however, I captured network packets and found that some OPTIONS requests to my handler are denied as 403 Forbidden even without reaching the handler and with anonymous access available. I strongly need this requests to be accepted, how should I do
As I read some other threads, it looks like I would have to add httpHandler section to the config. However, this is problem, since I do not have my handler pre-compiled.
in the myhandler.ashx is code like
public class MyHandler : IHttpHandler
and I've tried all cobinations which came to my mind, like
<add verb="*" path="MyHandler.ashx/*" type="Company.MyApp.ThinClient.MyHandler,MyHandler" />
but I'm not able to specify the correct type. What's the type or how can I find it?
Or any other idea how to get all of the requests?
Apr 30, 2006 02:13 AMemail@example.com|LINK
Nobody knows? That's not funny... I found that beacuse of dynamic compilation, I really need to compile my handler into dll and link it in order to specify it's type, however how can I do it, when I access the web-project defiend types from the handler?
May 03, 2006 04:23 AM|zhuhua1006|LINK
I am not sure whether you problem can be resolved by using a dll httphandler.I can only say if you want some file with certain extension to be handled by certain httphandler, the only way is to use a dll httphandler and add a section in the Web.Config.
I provide some artciles to you and hope they are helpful to you.
May 03, 2006 06:31 AMfirstname.lastname@example.org|LINK
Thank you for try. I read the articles and it didn't help me. At first, I don't need to handle any special extension, the handler is called just by its name.
What I have tried to do is, made a regular class (MyHandler.cs) from the ashx and put it into the App_Code directory. However it didn't helped.
Can you tell me, from the code I wrote in the first post, what the type should be?
I tried type="Company.MyApp.ThinClient.MyHandler,Company.MyApp.ThinClient"
but this shows up the configuration error in browser, Could not load file or assembly "Company.MyApp.ThinClient" or one of its depedencies, which is quite logical I think while the asembly is dynamically compiled and changes its assembly name every compilation.
May 03, 2006 07:08 AMemail@example.com|LINK
May 03, 2006 01:13 PMfirstname.lastname@example.org|LINK
I would like to share answer from Davd Wang with you (from microsoft newsgroup):
I'm working on a blog entry to answer this question (though I've got tons of
other things to do right now).
In short, you want to extend IIS server functionality with an ASP.Net
Handler, but based on what you have said, your assumptions about HttpHandler
definitely does not match reality so it all looks confusing to you. I agree,
it is our fault, and we are fixing it in IIS7 such that what you want to do
is easy. But, you don't have IIS7 yet, so you will have to understand how
IIS6 AND ASP.Net works to do what you want.
At minimum, you want to at least read the following blog entries to get
context of what you are trying to do:
WebDAV interaction is a special case for the IIS Request Pipeline. That's
why it's going to get special treatment with its own blog entry.
Well as long as DAV is concerned, actually... this isn't in fact my case, I
think. The IIS doesn't have DAV installed at all and also it doesn't know
that my handler is going to behave as DAV server.
Your articles helped a lot. I also noted that Application_BeginRequest
doesn't fired at all in cases of the denied requests, so it defnitelly seems
something has gone bad on the IIS side. I also found that DenisV at re:
HOWTO: IIS 6 Request Processing Basics, Part 1 from Tuesday, March 21, 2006
6:13 AM has the same problem.
What I expected is:
to do all the DAV stuff like handle OPTIONS, GET and so on on the file
marked with the guid. However, when Word is started from IE, it also queries
(as expected) OPTIONS on the http://server/MyApp/Document.ashx/, which isn't
unfortunately passed to the asp.net at all; thanks to you I think I know why
I used the /guid notation because this is the only method how to preserve
the guid in the request headers by Word, in contrast to ?guid..which was
always thrown away.
So... what you would you suggest me to do?
I was thinking about virtually making the path one level deeper, so when the
Word queries for the parent OPTIONS it will still get to my handler... will
Eg. to have http://server/MyApp/Documents/DummyLevel/guid and registering
the handler for path "Documents/*". (at the moment I have no registration
since .ashx is properly handled by the IIS)
However if this the way, then the problem is going to the ASP.NET guys, how
to register the handler, since I cannot define the type/assembly because of
the dynamic compliation.
So the first question now remains cricital... how can I register ashx handle in web.config?
May 03, 2006 08:50 PM|zhuhua1006|LINK
If you look into \WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config, you can see the following section:
<add path="*.ashx" verb="*" type="System.Web.UI.SimpleHandlerFactory" validate="True" />
That is the pattern you can reference to config ashx.
May 04, 2006 02:09 AMemail@example.com|LINK
zhuhua1006, it's the same all the time... what string should I write into the type attribute? In the first post is my whole code of the ashx file so please try to be concrete.