Last post Aug 05, 2018 07:31 PM by GeorgeClass
Member
29 Points
180 Posts
Aug 05, 2018 10:15 AM|GeorgeClass|LINK
Hi,
Most of popular email clients use autodiscovery to get the mail server configuration calling an xml in a location but passing data as querystring:
https://autoconfig.domain.com/mail/config-v1.1.xml?emailaddress=user@domain.com
And the result must be an xml
So far, I can show autodiscovery.xml and show the xml (eventhough the real file name is autodiscovery.aspx):
<system.webServer> <rewrite> <rewriteMaps> <rewriteMap name="/Autodiscover/Autodiscover.xml"> <add key="/Autodiscover/Autodiscover.xml" value="/Autodiscover/Autodiscover.aspx" /> </rewriteMap> </rewriteMaps> <rules> <rule name="Rewriting to /Autodiscover/Autodiscover.xml"> <match url=".*" /> <conditions> <add input="{/Autodiscover/Autodiscover.xml:{REQUEST_URI}}" pattern="(.+)" /> </conditions> <action type="Rewrite" url="{C:1}" appendQueryString="false" /> </rule> </rules> </rewrite> <httpErrors errorMode="DetailedLocalOnly" /> </system.webServer>
The problem comes when I pass the querystring, it returns:
What am I doing wrong? or is there another way to do it and I'm taking the hard way?
Regards
All-Star
48340 Points
18016 Posts
Aug 05, 2018 12:25 PM|PatriceSc|LINK
Try with those changes :
<conditions> <add input="{/Autodiscover/Autodiscover.xml:{URL}}" pattern="(.+)" /> </conditions> <action type="Rewrite" url="{C:1}" appendQueryString="true" />
REQUEST_URI includes the query string. URL does the match only on the URL part and then the querystring is appended.
Aug 05, 2018 07:31 PM|GeorgeClass|LINK
That did the job !!!
Thank you Patrice
Member
29 Points
180 Posts
Map .aspx as .xml extension and pass query string
Aug 05, 2018 10:15 AM|GeorgeClass|LINK
Hi,
Most of popular email clients use autodiscovery to get the mail server configuration calling an xml in a location but passing data as querystring:
https://autoconfig.domain.com/mail/config-v1.1.xml?emailaddress=user@domain.com
And the result must be an xml
So far, I can show autodiscovery.xml and show the xml (eventhough the real file name is autodiscovery.aspx):
The problem comes when I pass the querystring, it returns:
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
What am I doing wrong? or is there another way to do it and I'm taking the hard way?
Regards
All-Star
48340 Points
18016 Posts
Re: Map .aspx as .xml extension and pass query string
Aug 05, 2018 12:25 PM|PatriceSc|LINK
Hi,
Try with those changes :
REQUEST_URI includes the query string. URL does the match only on the URL part and then the querystring is appended.
Member
29 Points
180 Posts
Re: Map .aspx as .xml extension and pass query string
Aug 05, 2018 07:31 PM|GeorgeClass|LINK
That did the job !!!
Thank you Patrice