Tamir
Tamir

Reputation: 2533

Path rewrite on post data to WCF service

Let's assume that i have simple WCF service defined

[OperationContract, WebInvoke(Method = "GET", UriTemplate = "*")]
string TestMe ()

and simple http module to rewrite urls

context.BeginRequest += (s,e)=>{
var ctx = HttpContext.Current;
var method = ctx.Request.AppRelativeCurrentExecutionFilePath.RemoveFirst("~/");
var args = ctx.Request.QueryString.ToString();               
ctx.RewritePath("~/MyService.svc", method, args, false);
}

So each call to the method will be translated into TestMe method with parameters

Now i want to post entire request here,

[OperationContract, WebInvoke(Method = "POST", UriTemplate = "*")]
string TestMe (Stream request)

For this call RewritePath not passing stream being posted by the service requester and i was unable to find a way to workaround it. How rewrite url and keep original request byte array being transfered?

Upvotes: 2

Views: 575

Answers (1)

xtrem
xtrem

Reputation: 1779

During the processing of a POST request, URL Rewriting does not affect the body of the HTTP request.

The query string on the other hand is part of the URL, and you seem to have correctly transferred it to the new URL.

What are your symptoms?

Upvotes: 0

Related Questions