Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2012-03-23
3
Medium Priority
?
932 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

927 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