Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6118499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:26:37+00:00 2026-05-23T15:26:37+00:00

Ultimately, i’m trying to obtain a reference to the webmethod that will handle a

  • 0

Ultimately, i’m trying to obtain a reference to the webmethod that will handle a request, BEFORE it handles the request, in order to check its custom attributes.

Currently, I have it working by appending the request path to the project namespace, removing the .asmx extension and replacing slashes with dots. However, this assumes that the class namespace hierarchy matches the request path hierarchy, and there’s no reason why it should.

Short of opening the file and parsing it – is there a way that given a request path to an asmx file I can retrieve a reference to either the class type within or the name of the class type within?

Pretty new to .NET so what i’m doing might be silly. But either way, i’d be interested in the answer 🙂

EDIT: It’s not my project, and it’s locked in to using ASP.NET 3.5 and asmx webservices

EDIT: The aim is to be able to prevent certain webservices from being executed by unauthenticated users, without adding authentication code to every webmethod. My idea was to use a custom attribute on webmethods marking them as public, and only those will be allowed by a custom HTTP module or handler to be executed by an unauthenticated user. The type of user is stored in the session.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:26:38+00:00Added an answer on May 23, 2026 at 3:26 pm

    First of all, I will suggest that you switch to WCF web services because asmx is now considered as legacy technologies (see MSDN). WCF has several extension points in its pipe-line that should meet your goals.

    Now said that, one of the hack solution could be to put your own handler or handler factory for asmx files and then use WebServiceParser.GetCompiledType method to get actual asmx service type, inspect your attributes. You can then use WebServiceHandlerFactory.GetHandler to create actual handler and execute the request.

    Perhaps, you should explain what you want to do with custom attributes so that someone can provide you with the better solution.

    EDIT: In case you want to secure the entire asmx or directory then it can be easily possibly using built-in authorization – for example:

    <location path="secure.asmx">
     <system.web>
       <authorization>
         <allow users="*" />
         <deny users="?" />
       </authorization>
     </system.web>
    </location>
    

    This will allow access to all authenticated users and deny to anonymous users.

    If you want a granular control at web method level then I will suggest to put the entire logic in a helper method – say EnforceSecurity (static method or instance method on base web service call for asmx) and invoke the helper method in relevant web methods. Its more or less equivalent from what you wish to do – instead of decorating methods with custom attribute, you will insert a method call into it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This will ultimately be used on the iPhone but its a general question that
I have a site that will ultimately support 4 languages and 2 countries (US
I'm trying to build something (ultimately a gem but for now an application) that
I'm working to create a simple Python script that will ultimately tell you how
I need to build a small web app that will ultimately need to be
I guess I want to ultimately build out a script that will force the
I am developing a simulation in NetLogo that will ultimately have multiple permutations. In
I am working on my first asp MVC project that will ultimately end up
Using spring DefaultAnnotationHandlerMapping how can I lookup the Controller that would ultimately handle a
We are developing a custom textual DSL, that will ultimately get integrated into Visual

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.