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 196609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:46:55+00:00 2026-05-11T16:46:55+00:00

IIS enables us to also configure Asp.Net file mappings. Thus besides aspx, IIS also

  • 0

IIS enables us to also configure Asp.Net file mappings. Thus besides aspx, IIS also invokes Asp.Net runtime, when requests have the following file extensions:

a) .ascx –> .asmx extension is used to request user controls.

  • Since user controls can’t be accessed directly, how and why would anyone send a request to a user control?

b) .ashx –> this extension is used for HTTP handlers.

• But why would you want to request an .ashx page directly instead of registering this handler inside configuration file and enable it to be called when files with certain ( non ashx ) extensions are requested?

• Besides, since there can be several Http handlers registered, how will Asp.Net know which handler to invoke if they all use ashx extension?

• What does the requested ashx file contain? Perhaps a definition of a Http handler class?

• I know how we register Http handlers to be invoked when non-ashx pages are requested, but how do we register Http handler for ashx page?

c) .asax –> This extension is used to request a global application file

• Why would we ever want to call Global.asax directly?

• I assume that when request is made for Global.asax, an object derived from HTtpApplication class is created, except this time no web page processing takes place?

thanx


Q – Besides Asp.Net being able to request global.asax for compilation, is there any other reason why I would choose to request file with .asax extension directly?

• ashx files don’t have to be registered. They are basically a simpler aspx, for when you don’t need the entire page life cycle. A common use is for retrieving dynamic images from a database.

So if I write a Http handler, I should put it in a file with .ashx extension and Asp.Net will build an HttpHandler object similarly to how it builds a page instance from .aspx file?

• If a hacker did try to make a request for one of these files, what would you want to happen? You certainly wouldn’t want IIS to treat it like a text file and send the source for your app down to the browser.

Asp.Net could do the same it does with .cs, .csproj, .config, .resx, .licx, .webinfo file types. Namely, it registers these file types with IIS so that it can explicitly prevent users from accessing these files

•Just because you don’t expect requests from the browser for a resource, it doesn’t mean you don’t want that resource handled by the asp.net engine. These extensions are also how ASP.Net picks up files to compile for the web site model sites.

But then why doesn’t Asp.Net also allow .cs, .csproj, .config, .resx, .licx, .webinfo files to be directly requested?

a) and c) – as far as I am aware, these are not exposed to process any external requests

my book claims the two are mapped in IIS

I appreciate your help

EDIT:

b) The .ashx extention is defined in a config file it’s just not the web.config, its in the machine.config

<add path="*.ashx" verb="*" type="System.Web.UI.SimpleHandlerFactory" validate="True" />

http://msdn.microsoft.com/en-us/library/bya7fh0a.aspx

Why use .ashx: The difference is that the .NET class that handles a .ashx reads the Page directive in the .ashx file to map the request to a class specified in that directive. This saves you from having to put an explicit path in the web.config for every handler that you have, which could result in a very long web.config.

I thought Http handler class was defined inside .ashx file, but instead file with .ashx extension only contains Page directive?

Since I’m not 100% sure if I understand this correctly: Say we have ten Http handlers we want to invoke by making a request to IIS7. I assume for each Http handler there will be specific .ashx file –> thus if request is made for FirstHandler.asxh, then handler specified inside that file will be invoked?

YET ANOTHER EDIT:

I must confess that I’m still a bit unsure about ashx extension.

I realize that by using it we can for example create ‘hey.ashx’ page, where Page directive will tell which class ( Http handler) to invoke when request is made for ‘hey.ashx’ – thus no need to register Http handler in web.config.

But if you use Http handlers that way, then they will only get invoked when requests are made for files with .ashx extension. Thus, if I want Http handler to be invoked for files with other extensions, such as .sourceC, then I will still need to register Http handler in web.config?!

  • 1 1 Answer
  • 2 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-11T16:46:55+00:00Added an answer on May 11, 2026 at 4:46 pm

    To definitely clear any confusion you might have on what asp.net does with these requests, check the web.config in:

    %systemroot%\Microsoft.NET\Framework\v2.0.50727\CONFIG

    As you can see (posted mine below), asp.net excludes pretty much any of the files that you are unsure if they were receiving special treatment. Notice there is *.cs, *.acsx, *.asax.

    <add path="*.asax" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.ascx" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.master" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.skin" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.browser" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.sitemap" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.dll.config" verb="GET,HEAD" type="System.Web.StaticFileHandler" validate="True"/>
    <add path="*.exe.config" verb="GET,HEAD" type="System.Web.StaticFileHandler" validate="True"/>
    <add path="*.config" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.cs" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.csproj" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.vb" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.vbproj" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.webinfo" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.licx" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.resx" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.resources" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.mdb" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.vjsproj" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.java" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.jsl" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.ldb" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.ad" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.dd" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.ldd" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.sd" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.cd" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.adprototype" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.lddprototype" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.sdm" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.sdmDocument" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.mdf" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.ldf" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.exclude" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    <add path="*.refresh" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
    

    Also, bear in mind that IIS might not be configured to map some requests (MIME types) to the ASP.NET pipeline.

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

Sidebar

Related Questions

Summary: I have an ASP.NET MVC website in IIS named 'Website' using an AppPool
We have a couple of WCF services hosted in an asp.net application on IIS.
I have deployed a new version of an ASP.NET webservice. The IIS logfile reports
I have standard ASP.NET 4 application. Inside this application there are also few razor
Using ASP.Net 2.0 and IIS 6 I enabled compression by extending IHttpModule and registering
I have just upgraded my ASP.NET application from .NET 3.5 to 4.0 and have
While trying to deploy a simple asp.net mvc project on an IIS 6 server,
i tried to configure the .NET Compilation Settings in the IIS Manager but all
I have always enabled integrated security on my web apps inside IIS with the
In IIS 5.1, i have set the website security to Basic Authentications and i

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.