开发者

Best way to implement Server-Side redirection using WCF REST

We want to receive a GET request in www.contoso.com/Service(123) and based on some logic (token information in a custom header) redirect the request to www.contoso.com/Data/123.xml or to w开发者_JAVA百科ww.contoso.com/123_bak.xml without the client being aware of the redirection


Just to be clear, you're saying you don't want to return an HTTP based redirect, correct?What you're looking for is the equivalent of ASP.NET's Server.Transfer, right? If you are hosting in ASP.NET, then you could actually go ahead and use Server.Transfer to redirect the call.

In pure WCF this would be a job for routing. You might want to check out .NET 4's RoutingService. If you can't .NET 4, then you're kind on your own as there's no built-in solution for this in 3.5. For the example you gave I'd need to know more about who owns what URLs to give the best advice. For example, is the only REST URL WCF is handling the /Service(123), but the other URLs handled by some other service?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜