简体   繁体   English

在 C# web-service 中隐藏 function 输入参数?

[英]Hide function input parameters in C# web-service?

I have a question regarding if it is possible to hide inputs to a web-service method.我有一个关于是否可以隐藏对 Web 服务方法的输入的问题。

Lets say that the fourth parameter takes a password as input, and we want this input only to be used on the client side.假设第四个参数将密码作为输入,我们希望此输入仅在客户端使用。

The function has 4 input parameters, and is there any way possible to still have all the input parameters to the function but make the fourth parameter invisible when accessing the.asmx file through the web-browser? function 有 4 个输入参数,有没有什么办法可以保留 function 的所有输入参数,但在通过网络浏览器访问 .asmx 文件时使第四个参数不可见? This is to eliminate users trying to access the service and trying to input random data.这是为了消除试图访问服务并尝试输入随机数据的用户。

C# Web 服务中的参数输入。

EDIT: To place this in an example.编辑:把它放在一个例子中。

We have an iPhone application, when a user makes use of a function, some parameters are sent to the web-service along with the fourth parameter that should contain a key of some sort to validate that the user is on an actual iPhone using the application and not someone accessing the web-service trying to access data.我们有一个 iPhone 应用程序,当用户使用 function 时,一些参数与第四个参数一起发送到 Web 服务,该参数应包含某种密钥,以验证用户是否在使用该应用程序的实际 iPhone而不是访问网络服务的人试图访问数据。

public someVariable someFunction(someVar parameter1,someVar parameter2,someVar parameter3,someVar parameter4)
{

    if (key.isMatch(parameter4))
    {

       The user is on an iPhone using the app : Proceeding.

    }
    else
       The user is not on an iPhone, cancelling function.

}

you can prevent calling your method from webbrowser,by extending SoapExtension and getting extra information as soapheader,that just can be send by enduser app您可以防止从网络浏览器调用您的方法,通过扩展 SoapExtension 并将额外信息作为soapheader 获取,这些信息只能由最终用户应用程序发送

have a look to this Using SOAP Header and SOAP Extensions in a Web Service看看这个Using SOAP Header 和 SOAP Extensions in a ZC6E190B28404933C48EZDA9E5

The interface that you are using was not supposed to be used for anything but testing.您正在使用的界面不应该用于测试以外的任何用途。

If you need to use it on production you should rather implement your own page, so the TextBox for parameter 4 would be masked.如果您需要在生产中使用它,您应该实现自己的页面,因此参数 4 的 TextBox 将被屏蔽。

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

相关问题 从WSDL Web服务C#提取方法和输入参数 - Extract methods and input parameters from a WSDL web-service C# C#中带有参数的Web服务请求 - Web-Service request with parameter in C# C#Web服务实例 - C# web-service instances C# Web 服务客户端:具有相同(复杂)返回类型的多个 Web 服务方法? - C# web-service client: multiple web-service methods with same (complex) return type? 每当Web服务中变量的值更改时,调用函数/事件或将数据传递到Website(C#) - Call a function/event or pass data to Website(C#) whenever value of variable changed in Web-service 如何在C#中的Web服务方法内部调用异步函数 - How to call an async function inside web-service method in c# Java客户端对Web服务(c#)的用户名和密码请求 - java client request to web-service(c#) with username and password SAP Web服务将二进制数据传递给C# - SAP Web-Service pass Binary Data to C# XML 序列化问题 使用 C# 将数据保存到 Workday Web 服务时 - XML serialization issue While saving data to Workday Web-service with C# HttpWebRequest到C#中的Web服务; 如何从响应流中获取数据FAST? - HttpWebRequest to web-service in c#; how to get data FAST from the response stream?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM