By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,918 Members | 1,662 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,918 IT Pros & Developers. It's quick & easy.

Enabling & disabling of c# web method

P: n/a
Raj
Hi,

I have set of exposed web method (C#, framework). Now set of retailer
uses these methods and they are identified by their retailer ids.

Question is, Is there any way to disable a few methods based on
retailer id? This is required because few methods are not relevant for
some retailer but useful for others.

Help will be highly appreciated.

Thanks in advance to all dudes
-raj

Jan 24 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Raj wrote:
I have set of exposed web method (C#, framework). Now set of retailer
uses these methods and they are identified by their retailer ids.

Question is, Is there any way to disable a few methods based on
retailer id? This is required because few methods are not relevant for
some retailer but useful for others.

Help will be highly appreciated.


The simplest thing would be to just throw an exception if the method
call is inappropriate. In theory I guess you could have separate WSDL
for each retailer, or split the interface into several interfaces, but
you'd still need to perform the check anyway.

Just document very carefully what's appropriate for each type of
retailer.

Jon

Jan 24 '06 #2

P: n/a
Raj
Hi Jon,

Thanks for spontaneous reply. I have this in mind to throw exception
before actually going to method based on the retailer id, which anyway
i will be getting as part of soap header.

Can anything else be done instead of throwing exception??

thanks
-raj

Jan 24 '06 #3

P: n/a
Raj wrote:
Thanks for spontaneous reply. I have this in mind to throw exception
before actually going to method based on the retailer id, which anyway
i will be getting as part of soap header.

Can anything else be done instead of throwing exception??


Well, what would you want to happen if the "wrong" retailer called the
method? They would certainly be able to create the write soap request -
so what do you want them to see? What do you dislike about throwing an
exception?

Jon

Jan 24 '06 #4

P: n/a
I don't think that this is the best idea, actually. I mean, an
exception, yes, is the right thing to do, but I don't think that he should
be implementing something for himself when there are solutions out of the
box that can help.

At the least, he should have an implementation of IPrincipal which
identifies the caller (after all, there is some sort of authentication on
his part somewhere).

Then, each retailer would be assigned a role. The web method attribute
would also be adorned with a set of PrincipalPermission attributes,
indicating the roles that have access to the method. With the right
assignments and attribute settings, the framework could do the checks for
him.

To take this even further, the OP should probably look into the Web
Services Enhancements module from MS:

http://www.microsoft.com/downloads/d...displaylang=en

There is an implementation of WS-Security, which basically does the same
thing, and will provide greater iteroperability with other technologies
which use the WS stack.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Raj wrote:
I have set of exposed web method (C#, framework). Now set of retailer
uses these methods and they are identified by their retailer ids.

Question is, Is there any way to disable a few methods based on
retailer id? This is required because few methods are not relevant for
some retailer but useful for others.

Help will be highly appreciated.


The simplest thing would be to just throw an exception if the method
call is inappropriate. In theory I guess you could have separate WSDL
for each retailer, or split the interface into several interfaces, but
you'd still need to perform the check anyway.

Just document very carefully what's appropriate for each type of
retailer.

Jon

Jan 24 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.