0

I have a web service accepting data from client applications, but now the owner wants to change the domain of the web service. If i 301 redirect the old domain to the new domain, will the web service still function normally? Im trying to avoid the need to update all the client applications which are numerous.

More info: So a C# winforms app is sending and pulling data from: test.com/service.asmx, however the client is changing the domain to newtest.com/service.asmx and 301 redirecting the old domain. I've attempted to connect to the service with the winform app, still configured with the old domain, but it fails. Is there any configuration on the server or webservice that i could perform to make this work without requiring modifications to the client applications? This .net 3.5 btw.

SirM
  • 487
  • 6
  • 22
  • Do the clients know how to handle 301 redirects? – Nkosi Dec 07 '16 at 17:03
  • Not a 100% sure what you mean, but if you are asking if there is any coding pertaining to redirects in the client apps, i do not think so as this situation wasnt expected when built. The client call to the webservice is pretty basic: HC.TimeEntryWebService.time_entrySoapClient soapClient = new HC.TimeEntryWebService.time_entrySoapClient(); e.Result = soapClient.IsOnline(); – SirM Dec 07 '16 at 17:13

2 Answers2

1

Instead of a redirect at application level, I would recommend you use a DNS based solution. Point the old domain to the new domain using a CNAME record or the old domain to the IP using a A record (if the IP is static).

A CNAME record provides an alias, which is what you need here.

test.com CNAME newtest.com

If you let us know how the webservice is hosted (physical, VM, AWS/Azure), I might be able to tell you the exact solution.

This is assuming that the customer will continue to own the old domain (along with the new one) until the client apps are alive. If that is not the case, then the 301 will not work anyways.

AVS
  • 531
  • 2
  • 13
  • Most helpful solution but alas, they dont want to run both domains at the same time. – SirM Dec 09 '16 at 16:39
0

The answer is no, returning a 301 response will not guarantee a client redirects. It depends on the implementation of the client.

I'll assume your clients are .net clients, if you're using HttpWebClientProtocol...

https://msdn.microsoft.com/en-us/library/system.web.services.protocols.httpwebclientprotocol.allowautoredirect%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396

...then you would need to set AllowAutoRedirect to true, by default this property is set to false.

However, if you're using HttpWebRequest...

https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.allowautoredirect(v=vs.110).aspx

...AllowAutoRedirect defaults to true.

Without posting some code used to make requests in your client, there's no way to answer this question with any certainty.

In either case I do not believe there's a way to use the application config to set the value of the AllowAutoRedirect property.

Mick
  • 6,527
  • 4
  • 52
  • 67