Solved

How to do  ASP.NET WebForms routing for asmx Web Services?

Posted on 2012-03-23
3
781 Views
Last Modified: 2012-05-29
Hi experts! I'm trying to enable ASP.NET WebForms routing to an asmx Web Service.

The following returns a "Type 'myproject.myservice' does not inherit from 'System.Web.UI.Page'" error:

routes.MapPageRoute(
            "The_Route_Name_For_This_Service",
            "somethingfantastic/",
            "~/services/myservice.asmx?op=MyFunction"
        )

Open in new window


How can I add paths to asmx web services to my RouteCollection?

Your help is greatly appreciated!
0
Comment
Question by:Drevo
3 Comments
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 500 total points
ID: 37759113
you cannot route a request to an aspx page, which is a class derived from page class which is the page's HTTPHandler to a asmx page.

By default Instance of Page is created whenever a request is made for an aspx page, however i think if you can write your own HttpModule, you can override this behaviour and have your own handler get called.
0
 

Author Comment

by:Drevo
ID: 37772783
Thanks for your comment BuggyCoder! Though you can route requests to aspx pages. I think you're right that something needs to be overridden to route to an asmx web service. I don't know exactly how though, which leaves this question still open. Perhaps some kind of extension of IRouteHandler and/or IHttpHandler?

In the meantime I'm just checking for specific URL path patterns in Application_BeginRequest and doing a Context.RewritePath to the matched web service.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to use odbc in vb to connect to ms sql 14 40
vb.net checkbox 7 41
Error in JQuery 5 39
Close form "before" open 3 30
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now