开发者

Any ideas on a WCF Interceptor for a REST WebGet request to change the Url/Querystring parameters

Does any one know of a way I can intercept a REST Get request inside WCF, so for example I could change the value of any of the querystring parameters. 开发者_StackOverflowSo I need to have some code run, prior to WCF Evaluating the UriTemplate of the WebGet attribute and be able to edit it, before returning the value which it will use to continue processing the request.

Any help would be greatly appreciated

Andrew


This little snippet shows you how you can change/alter the url:

    /// <summary>
    /// Interface for communicating with twitter.com.
    /// </summary>
    [ServiceContract]
    public interface ITwitterClient
    {
        [OperationContract]
        [WebGet(UriTemplate = "statuses/user_timeline/{twitterName}.xml?count={numberOfTweets}",
            BodyStyle = WebMessageBodyStyle.Bare,
            RequestFormat = WebMessageFormat.Xml,
            ResponseFormat = WebMessageFormat.Xml)]
        Statuses PublicTimeline(string twitterName, int numberOfTweets);
    }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜