Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Oct 27, 2011 06:30 PM by jaspreet.singh
Oct 26, 2011 10:52 AM|LINK
How i can know the function name that is being called in Web Service , in the HttpModule.
Also i have created a web service and created an HttpModule . Registered Web Service with HttpModule.
How i can get the function name that is being called by user in HttpModule.
I have put code in Init method of Httpmodule and also registered with begin request event as below:
public class MyClass:IHttpModule
public void Init(HttpApplication context)
public void context_BeginRequest(Object s, EventArgs e)
Oct 26, 2011 03:59 PM|LINK
What you are trying to achive can only be done using AOP (Aspect oriented programming). It cannot be done using httpmodules.
Its a classic cross cut concern, which involves method interecption.
C# and .net do not support this out of the box, but there are many 3rd party frameworks out there which allow you to achive this.
.net has been designed to support this feature in the future. It can easily be achived by using attributes on classes and methods.
But when and if they will ever get around to including it in the framework is not sure.
For now you are better of using a established 3rd party library. Some require a licence some are free.
Here are some links.
Oct 27, 2011 09:21 AM|LINK
Thanks for your reply. Actually i want to Log Errors in the Web Service using HttpModules which is quite possible. So i also wanted to log in which function the error has occured. So i wanted to know function name..
Oct 27, 2011 11:07 AM|LINK
Oh my bad then, in that case things work out much easier.
What your are requesting to do is known as ELMAH's Architecture.
There are some well know ways to implement this.
Here's MSDN write up on it. http://msdn.microsoft.com/en-us/library/aa479332.aspx
Oct 27, 2011 06:30 PM|LINK
There is a note given in above link :
<div>Note For more information on creating custom error pages, read Eli Robillard's article
Rich Custom Error Handling with ASP.NET.</div>
<div>Note When an unhandled exception occurs in an ASP.NET Web service, the <div class="tt">Error</div> event is not bubbled up to HTTP modules and thus ELMAH. Rather, it is intercepted by the ASP.NET runtime and
a SOAP fault is returned to the client. To have an error logged in a Web service, you would need to create a
SOAP Extension that listened for SOAP faults.</div> <div> </div> <div> </div> <div>It can not be done using ELMAH rather not that much simple and easy -:). and is possible using SOAP Extension,
can somebody please provide me simple example code. I find it hard that's provided in above link of SOAP Extension.</div> <div> </div> <div>Thanks</div>