Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?
Posted
Comments
Sreekanth Mothukuru 22-Jun-15 3:29am    
Enable session for the asmx web service and pass the user id value through Session.
Adil S 22-Jun-15 5:10am    
Thanks, I created a session and tried to access in webservice with attribute [WebMethod(EnableSession = true)]
I was not able to get the session value.

Please can you provide more details.

Add a key in your web config and set the value for it at runtime to provide value in each method
 
Share this answer
 
Comments
Adil S 22-Jun-15 4:47am    
User Id is dynamic for each login. So cant have it in web.config file.
use a global variable that is accessible to every class, like the methods of ADO .NET that are accessible to every user
 
Share this answer
 
Comments
Adil S 22-Jun-15 5:14am    
Please can you elaborate, global variable in the application to be uses in webservice you mean? I might have to modify all models then. Not all methods have the same parameter.
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
 
Share this answer
 
v2
Comments
Deepu S Nair 22-Jun-15 6:59am    
Three solutions for a single question?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900