Webservice Redirection [Answered]RSS

2 replies

Last post Oct 13, 2020 12:12 PM by Pete44

  • Webservice Redirection

    Oct 12, 2020 09:53 AM|Pete44|LINK

    Hi Everybody!

    I work with Internet Information Services 10.0.14393.0

    I have a webservice website which is today called with an URL like 
    http://hostname/webservice1.ashx?id=yyyyy


    I want to call it with 
    http://mynewurl/webservice1.ashx?id=yyyyy


    I want people who use the former URL to be redirected to the new URL (including the webservice part).
    I setup a Redirection on IIS to http://mynewurl/ but when I call http://hostname/webservice1.ashx?id=yyyyy, I'm not redirected to 

    http://mynewurl/webservice1.ashx?id=yyyyy as I expected.

    How can I achieve this?


    Thanks a lot for your help. 

  • Re: Webservice Redirection

    Oct 13, 2020 03:30 AM|Jalpa Panchal|LINK

    Hi,

    You could use below URL rewrite rule:

     <rule name="redirect to the new url" stopProcessing="true">
                        <match url="(.*)" />
                        <conditions>
                          <add input="{HTTP_HOST}" pattern="domain.com" />
                          <add input="{REQUEST_URI}" pattern="(.*)" />
                        </conditions>
                        <action type="Redirect" url="http://example.com{REQUEST_URI}" appendQueryString="false" />
                    </rule>

    if you want to match any particular page then you could modify the condition like this:

     <add input="{REQUEST_URI}" pattern="webservice1.ashx" /> 

    Regards,

    Jalpa

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: Webservice Redirection

    Oct 13, 2020 12:12 PM|Pete44|LINK

    Finally succeed in, creating an "empty" website for http call and  using http://mynewurl$V$Q in my Redirection rule.

    Thanks for your help Jalpa.