将额外参数传递给asmx webservice [英] Passing Extra Parameter to asmx webservice

查看:116
本文介绍了将额外参数传递给asmx webservice的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个已经存在的webservice,从应用程序中调用了100个函数。



我需要在应用程序到webservice上再添加一个参数(UserId)每次通话。



我必须手动编辑所有功能和来自应用程序的电话的签名来实现它。



是否有更好/替代的方式在每次通话时将我的用户ID发送到网络服务?

解决方案

在网络配置中添加密钥并设置在运行时为每个方法提供值的值

使用每个类都可访问的全局变量,例如每个用户都可以访问的ADO .NET方法


一个通用类必须存在于一个解决方案中,我们可以在这样的类中声明一个公共变量,并为用户ID分配值,可以进一步用于功能实现



如果可能请提供你的代码


I have an already existing webservice having 100s of functions being called from the application.

I need to add one more parameter (UserId) from application to webservice on each call.

I'll have to manually edit signatures of all the functions and calls from application to achieve it.

Is there a better / alternative way of sending my User Id to webservice on each call?

解决方案

Add a key in your web config and set the value for it at runtime to provide value in each method


use a global variable that is accessible to every class, like the methods of ADO .NET that are accessible to every user


A general class must exists in a solution we can declare a public variable in such a class and assign value for user Id that can be used further for functionality implementation

If possible please provide your code


这篇关于将额外参数传递给asmx webservice的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆