Determine which WebService class serves the request

S

Sergi Adamchuk

I need determine which web service (class WebService or its inheritors)
serveces current request (I need Type instance of class that serves
request).

For example you wrote your own WebService:

[Guid("4543545454....")]
public class MyService : WebService ....

Now I need to know the Guid of WebService class that serves current
request

I solved simultinous problem for Page, but for WebService it looks more
difficult.

Thanx for help.

Here is solution with Page:
in Global.asax.cs

protected void Application_EndRequest(Object sender, EventArgs e)
{
Page page = Context.Handler as Page;
if ((page != null)&&(Business.Security.Session.Current != null))
{
Type pageType = page.GetType().BaseType;

// I have information about class (Page) servicing request
Guid guid = pageType.Guid;
}
}
 
D

Dino Chiesa [Microsoft]

why does the approach not work for

WebService svc = Context.Handler as WebService ;

??
-Dino
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top