0

For normal .aspx pages I can just put a Form.browser file into the App_Browsers directory like the following.

<browsers>
    <browser refID="Default">
        <controlAdapters>
              <adapter controlType="System.Web.UI.HtmlControls.HtmlForm"
                       adapterType="MyProject.FormRewriterControlAdapter" />
        </controlAdapters>
    </browser>
</browsers>

And in that class I can rewrite the action attribute of the form. However in the case of web service help pages, this file is not considered and the form is written with the default action (using an absolute URL).

This doesn't let me use a reverse proxy (Ionic's ISAPI Rewrite Filter - IIRF) to access my web service.

How can I accomplish this and rewrite the form action on the help page correctly?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Durden81
  • 966
  • 9
  • 25
  • Web services don't use HTML, so they don't have forms, so they don't have forms actions. What are you trying to accomplish? – John Saunders Sep 26 '11 at 15:21
  • I am just trying to make a webservice work on a website that is on reverse proxy. The action of the form that is written in the page to test live the web service (i.e. in the page MyWebService.asmx?op=MyMethod) doesn't write the action correctly so the form doesn't work. I want to be able to rewrite that action like in every other form in my website. – Durden81 Oct 05 '11 at 09:28
  • You should ignore that page. It's not important. In fact, you should really be ignoring ASMX web services entirely. Microsoft considers them to be a legacy technology. You should be using WCF instead. BTW, interesting hack using a control adapter to rewrite the form. I don't think that's what control adapters were meant for. – John Saunders Oct 05 '11 at 15:33
  • WebForms ASP.NET programming has to be full of hacks if you have the disadventure of having that technology on a big project. – Durden81 Oct 06 '11 at 17:14
  • I believe there is no other way to implement rewriting of the Url in IIS 6.0 without using this hack. I could list tens and tens of hacks that were needed because of webforms poor implementations.. I will look more into WCF, but I don't think we will migrate to it in the near future. So for now I think I will need to find a new solution and give up reverse proxy altogether. – Durden81 Oct 06 '11 at 17:20
  • ASMX has nothing to do with webforms. The page you refer to is just a "help page" for the service. It is not part of the service itself, and has nothing to do with how the service is called. – John Saunders Oct 06 '11 at 18:03
  • I believe that the relative importance of this help page is subjective to the use of the web-service. So I personally think this is a bug and you don't. It is a matter of personal opinion so we shouldn't continue this further. Maybe an external tool could "fix" this problem by building working help pages using reflection where we could actually customize them and also use them in this scenario. But I didn't find such a tool.. – Durden81 Oct 11 '11 at 11:10
  • Yes ASMX has nothing to do with webforms but my comment about hacks being necessary was just a little rant referred to webforms and a follow up to your comment about the App_Browsers hack. – Durden81 Oct 11 '11 at 11:23
  • 1
    Look in C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\DefaultWsdlHelpGenerator.aspx, which is the default. You can customize this using the [``](http://msdn.microsoft.com/en-us/library/ycx1yf7k.aspx) element. – John Saunders Oct 11 '11 at 13:49
  • Great, Thank you! That's what I was looking for.. if you give that as an answer I will vote for it! – Durden81 Oct 11 '11 at 14:13
  • See http://meta.stackexchange.com/questions/109011/too-many-restrictions-in-titles to explain the spelling in the title. – John Saunders Oct 11 '11 at 14:38

1 Answers1

1

If you need to change the help page, use the <wsdlHelpGenerator> element in the web.config.

You can find the default help page at C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\DefaultWsdlHelpGenerator.as‌​px.

Note that this will only help you when testing the service through the help page. It has nothing to do with how clients will access the service.

John Saunders
  • 160,644
  • 26
  • 247
  • 397