简体   繁体   English

如何在不使用(?)符号的情况下将参数传递给其他Web服务?

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

I have developed a rest web service by using the following link 我使用以下链接开发了一个休息Web服务

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

Now, I am passing parameters to this rest web service by using URL. 现在,我使用URL将参数传递给此休息Web服务。 I am passing parameters as follows 我传递的参数如下

http://localhost:50362/PMTSRest/Service.svc/GetProjects?ProjectID=1 HTTP://本地主机:50362 / PMTSRest / Service.svc / GetProjects专案编号= 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 ? 现在我想知道有没有办法删除URL中的问号而不是使用任何其他符号或如何在不使用(?)符号的情况下将参数传递给其余的Web服务? 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来隐藏这些参数?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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