473,769 Members | 6,187 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.NET Remoting Return SecurityExcepti on IMessage

Not that I've ever gotten any reponse to questions in the past, but I don't
know where else to turn.
I have a remoting application (.NET 2.0, VS 2005, C#) with a custom
ChannelSinkProv ider as described in this article
http://msdn2.microsoft.com/en-us/library/ms973909.aspx

This example uses role-based security by way of decorating each method with
[PrinciplePermis sionAttribute(S ecurityAction.D emand, Role="Administr ator")]
or some other programmer defined role.

It works fine... the problem is, the user has no idea why the action is not
being performed, it just silently fails if the user is not a member of the
specified role. I would like to capture this SecurityExcepti on message and
send it back to the user as a Response to their request, then handle the
Response by printing it to the status bar in the client application.

But I can't figure out where to capture this exception and create the
response message because it's an attribute on the method. Where would the
exception occur? My code is identical to the code at the above website.
Nov 7 '07 #1
4 2039
Yes, thank you very much Jialiang... your interpretation of my puzzlement was
right on base.

So, based on what you are telling me, I can simply capture the "Response"
from the method by placing the call from the remote client in a try{} catch
{} clause?

I don't need to append the denial message to the IMessage object in the
MessageSink chain?

Ultimately, this is what I'd like to get to... I have the Remote Server
running on a network machine which is a domain member. The clients are also
network machines within the same domain. The "services," which I call Remote
Objects are located on the server machine, as well, with similar signatures...

[PrinciplePermis sionAttribute(S ecurityAction.D emand, Role="GroupMemb er")]
public RemoteableObjec t GetData()
{
RemoteableObjec t thisRemObj = new RemoteableObjec t();

// do some work

return thisRemObj;
}

So in the client I would use the following pattern to access this Remote
Object through an Interface

private void AccessRemoteObj ect()
{
IGetData data =
(IGetData)Activ ator.GetObject( typeof(IGetData ),string.Format ("tcp://{0}:{1}/{2}/GetData",Server ,PortNumber , ApplicationName ));
RemoteableObjec t RO = new RemoteableObjec t();
try {
RO = data.GetData()
}
catch (SecurityExcept ion se) {
Trace.Write(se. Message.ToStrin g());
}
}

But I'll be using Asynchronous access, so I'm guessing this should also work
by way of a delegate within the client with a callBack handler... does this
sound pheasible?
Nov 8 '07 #2
Hello,

As we see, if it is a synchronous call, we can simply add the try {} catch
around the method data.GetData(). But if it is an asynchronous one, adding
the try {} catch around BeginInvoke may not help. We need to add the try
catch around the EndInvoke call in its call back function.

If you have any other question or need anything else, please feel free to
let me know.

Sincerely,
Jialiang Ge (ji****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== ====
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=============== =============== =============== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
Nov 9 '07 #3
Hello,

Would you mind letting me know the result of the suggestions. Please feel
free to let me know if you further questions or concerns.

Sincerely,
Jialiang Ge (ji****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== ====
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=============== =============== =============== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
Nov 13 '07 #4
Yes, thank you very much for your help. The first post led me to the correct
capture location where I was able to communicate back to the user, the
results of their request. This also works in the callback of an asynchronous
request.

Thanks again,

Sam Martinez
Nov 13 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3076
by: Skip | last post by:
Hi, I'm new to .NET remoting and there's something I'm having real trouble with. Basically, I'd like to create a component that can act as a server and as a client (can send messages and receive them in asynchronous mode). Here's the situation just so you guys understand why I'm doing this (and maybe so that you can provide me with other options): I have an application that needs to save data to a remote database. The
0
246
by: DC | last post by:
Hi, I am trying to serialise an object across remoting, and I get the following message: System.Runtime.Serialization.SerializationException: Because of security restrictions, the type ExceptionDispatch.MessageObjectSerialise cannot be accessed. ---> System.Security.SecurityException: Request failed. at
2
3085
by: DC | last post by:
Hi, I am trying to serialise an object across remoting, and I get the following message: System.Runtime.Serialization.SerializationException: Because of security restrictions, the type ExceptionDispatch.MessageObjectSerialise cannot be accessed. ---> System.Security.SecurityException: Request failed. at
0
3403
by: Kristian Reukauff | last post by:
Hi I have a problem with the .Net-Securty-Functions. I've got a client and a server. When I try to register a channel at the server with this line: ChannelServices.RegisterChannel(chan, false); I get the following error - doesn't matter if I try it local from my machine or from a remote machine. (After the Errormessage is more text ;))
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3959
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.