I'm working on a Rest Service in .Net 4, and I need to perform a redirect.
A little description of what I'm doing: I have a silverlight application that contains a button. When I click the button, I send a POST request to my REST service with some information. From that information, I create a URL and (try to) redirect the browser. Here's the code for the method in the service:
[WebInvoke(Method = "POST", UriTemplate = "OpenBinder")]
public void OpenBinder(int someId)
{
string url = getUrl(someId);
if (WebOperationContext.Current != null)
{
WebOperationContext.Current.OutgoingResponse.Location = url;
WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.Redirect;
}
}
This seems to execute correctly, but when I call EndGetResponse on the client, I see that a "Security Error" occurred. It's System.Security.SecurityException, but I don't get any more details than that. Any ideas on what could be going on here?