using an .ashx or .axd ?

Last post 02-19-2006 2:11 PM by ScottGu. 1 replies.

Sort Posts:

  • using an .ashx or .axd ?

    02-17-2006, 12:07 PM
    • Contributor
      2,857 point Contributor
    • Pluginbaby
    • Member since 11-20-2005, 8:07 PM
    • Canada
    • Posts 484
    • TrustedFriends-MVPs

    Hi,

    I think I know the diffrence between an .ashx file and an .axd registred in web.config, but I wonder if there is a particular reason to use the one or the other in a project, and why ?

    Does anyone has a clear explanation on this ?
    Are there best-practices to choose whether to use ashx or axd ?

    (If this has answered your question, please click on "Mark as Answer" on this post. Thank you!)

    Laurent Duveau
    Silverlight MVP / Silverlight Insider
    http://weblogs.asp.net/lduveau/
  • Re: using an .ashx or .axd ?

    02-19-2006, 2:11 PM
    • Star
      14,618 point Star
    • ScottGu
    • Member since 06-05-2002, 4:36 PM
    • Redmond, WA
    • Posts 2,004
    • AspNetTeam
      Moderator

    You should actually be able to use either extension -- both can be mapped to your own custom IHttpHandler.

    If I had to pick one to use, I'd probably go with a .ashx extension.  One reason for this is that there are no built-in .ashx end-points in ASP.NET -- whereas there are a few .axd ones (for example: the new webresources.axd).  So going with a .ashx reduces the chance of a naming conflict. 

    .ashx files also now have intellisense support in VS 2005 -- so that makes building them easier as well.

    Hope this helps,

    Scott

Page 1 of 1 (2 items)