简体   繁体   中英

How to pass parameters to rest web service without using the (?) Symbol?

I have developed a rest web service by using the following link

http://www.c-sharpcorner.com/UploadFile/dhananjaycoder/simplerestservice11172009221218PM/simplerestservice.aspx

Now, I am passing parameters to this rest web service by using URL. I am passing parameters as follows

http://localhost:50362/PMTSRest/Service.svc/GetProjects?ProjectID=1

Now I want to know is there any way to remove the question mark in the URL & instead of it use any other symbol or how to pass parameters to the rest web service without using the (?) symbol ? Can you please provide me any code or link through which I can resolve the above issue?

I think you are asking how to put the parameters in a path segment. eg

[ServiceContract]
public interface ISearch
{
    [OperationContract]
    [WebGet(UriTemplate = "/Search/{name}", BodyStyle = WebMessageBodyStyle.Bare)]
    string  GetGreeting(string name);
}

Is this what you are looking for?

也许使用HTTP POST而不是HTTP GET来隐藏这些参数?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM