Hiding asmx?wsdl RRS feed

  • Question

  • Hi,

        Have been researching on this for a while now.  I could find couple of solutions to this and tried them. But have the following problem.   

    Have been trying to hide the actual asmx?wsdl file by specifying the webservice binding attribute and also specified the location tag for the same which is pointing to some custom file. Also, have mentioned the soapmethod attribute to the webmethod and given the same binding as specified in the webservice binding . 

    Below is the tag declared on the top of the service

    [Webservice(Name="MyBinding", location="help.aspx")]

    and for a webmethod



    Have added the protocol with documentation in the config file, so that it should direct to the custom file. Also, our clients access the service through httppost.



    <add name="httppost"><add name="httpget">

    <add name="documentation">


    But in vain.  When I browse the service.asmx?wsdl, it is always showing the actual wsdl file generated by ASP.Net

    Infrastructure.  Not knowing the reason.  Do we need to modify or mention any other settings other than these. Could any one help on this please?

    Saturday, October 26, 2013 5:09 PM

All replies

  • Hi,

    In order to hide the asmx?wsdl, please try to follow the one of the these two solution:

    1) add this in ur web.config

                 <wsdlHelpGenerator href="helpPage.aspx"></wsdlHelpGenerator> // u need to create this page (simple aspx/htm to show to users)



    < system.web>
             <remove name="HttpPost" />
             <remove name="HttpGet" />
            <remove name="Documentation"/>
    < /webServices>
    < /system.web>

    Note   Removing the Documentation protocol also disables WSDL file generation for any XML Web services within the Web application. This prevents clients from generating a proxy class unless a custom WSDL file is created and provided for them. To leave WSDL file generation on for XML Web services within a Web application, but not provide any human readable information regarding the XML Web services, you can add an <wsdlHelpGenerator>

    If you follow second step then you might get the error " Request format is unrecognized. " so then you have to alter DefaultWsdlHelpGenerator (this will affect all the Web services deployed on the Web server) or simply add one simple page and refirect it from wsdlHelpGenerator (which will affect only to that web service)Page

    <wsdlHelpGenerator href="helpPage.aspx"></wsdlHelpGenerator>

    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 28, 2013 6:51 AM
  • Thanks Amy for that reply.  Have actually tried  with wsdlhelpGenerator tag.  It only redirects the asmx page to that helpPage.aspx but when we given the  service.asmx?wsdl in the browser, again it shows the same autho-generated wsdl and doesn't hide WSDL or direct the user to custom page.   For this reason, as per my knowledge we use location attribute inside the webservice binding tag.  But this is actually not working for me.  Could you help me is there any other way we can direct the user to a different page or  a custom page when user types service.asmx?wsdl

    Thanks in Advance!

    Tuesday, October 29, 2013 12:57 PM
  • How to bind web service for specific page.?
    Friday, April 25, 2014 6:16 PM