Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2012-03-23
3
811 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

792 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