session.MessageBox, "Access is denied"

105 views
Skip to first unread message

Alexander Wolff

unread,
Sep 20, 2011, 12:55:49 PM9/20/11
to Cassia Users
I'm trying to develop an application that does the following:
1) send a message to all users connected to a set of Terminal Services
serversindicating that the session will be closed
2) closing sessions of these users

Part 2) works correctly, but when trying to send a message using the
method:

session.MessageBox ("test message")

the application gives the following error:

'session.MessageBox ("test message")' Threw an exception of type
'System.ComponentModel.Win32Exception'
System.Runtime.InteropServices.ExternalException} {base: {"Access
is denied"}
NativeErrorCode: 5

any idea how to solve it?

thanks in advance,
Alexander

Dan Ports

unread,
Sep 20, 2011, 1:27:53 PM9/20/11
to cassia...@googlegroups.com
Alexander,

A couple of suggestions off the top of my head:
  • Does the user the code is running under have the Message permission for the session in question? If the code is running under an administrator user account, is it running with elevated privileges?
  • Are you sure you're not trying to invoke MessageBox on a session that wouldn't support it, like the TCP listening session?
If that doesn't help, please reply with answers to the following:
  • How are you closing the sessions of the users you decide to boot?
  • Is this a remote call (i.e. using GetRemoteServer())?
  • What version of Windows is the client running (the machine calling MessageBox)?
  • What version of Windows is the server running?
  • What version of Cassia are you running?
Dan


--
You received this message because you are subscribed to the Google Groups "Cassia Users" group.
To post to this group, send email to cassia...@googlegroups.com.
To unsubscribe from this group, send email to cassia-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cassia-users?hl=en.


Alexander Wolff

unread,
Sep 20, 2011, 4:43:29 PM9/20/11
to Cassia Users
Hi Dan, thanks for the quick response.

servers are windows 2003, I'm using 2.0.0.60 cassia

if I connect to terminal services manager with the same user which
runs the program, I can send messages to users correctly (I guess this
is no issue of privilege)

yes, is a remote call, in the code im using:
ITerminalServer GetServerFromName server = (serverName)

The sessions were closed without problems using:
session.Logoff ();

On Sep 20, 2:27 pm, Dan Ports <danpo...@gmail.com> wrote:
> Alexander,
>
> A couple of suggestions off the top of my head:
>
>    - Does the user the code is running under have the Message
> permission<http://msdn.microsoft.com/en-us/library/aa383488>for the
> session in question? If the code is running under an administrator
>    user account, is it running with elevated privileges?
>    - Are you sure you're not trying to invoke MessageBox on a session that
>    wouldn't support it, like the TCP listening session?
>
> If that doesn't help, please reply with answers to the following:
>
>    - How are you closing the sessions of the users you decide to boot?
>    - Is this a remote call (i.e. using GetRemoteServer())?
>    - What version of Windows is the client running (the machine calling
>    MessageBox)?
>    - What version of Windows is the server running?
>    - What version of Cassia are you running?
>
> Dan
>
> On Tue, Sep 20, 2011 at 12:55 PM, Alexander Wolff <alexander.wo...@gmail.com

Dan Ports

unread,
Sep 20, 2011, 4:49:35 PM9/20/11
to cassia...@googlegroups.com
Alexander,

Your problem may be related to this issue, which was already fixed on the trunk version. Try using an overload of MessageBox that takes a caption and pass a non-empty string for that parameter.

Is the machine you are running this code on (not the machine you are connecting to) also a 2003 box?

Dan

Alexander Wolff

unread,
Sep 20, 2011, 5:44:13 PM9/20/11
to Cassia Users
yes, the machine where I run the code is a windows 2003

On Sep 20, 5:49 pm, Dan Ports <danpo...@gmail.com> wrote:
> Alexander,
>
> Your problem may be related to this
> issue<http://code.google.com/p/cassia/issues/detail?id=35>,
> which was already fixed on the trunk version. Try using an overload of
> MessageBox that takes a caption and pass a non-empty string for that
> parameter.
>
> Is the machine you are running this code on (not the machine you are
> connecting to) also a 2003 box?
>
> Dan
>
> On Tue, Sep 20, 2011 at 4:43 PM, Alexander Wolff
> <alexander.wo...@gmail.com>wrote:

Dan Ports

unread,
Sep 20, 2011, 10:39:54 PM9/20/11
to cassia...@googlegroups.com
OK. Does calling a different overload of MessageBox and providing a caption yield the same result? Can you test this using the latest trunk version of Cassia, which you can download from the build server (login as a guest and use the artifacts link)?

Can you provide a stack trace (at least for the portions within Cassia)?

Dan

Alexander Wolff

unread,
Sep 21, 2011, 11:03:44 AM9/21/11
to Cassia Users
same result :(

ok, I'll try the latest trunk and if that fails I'll send the stack
trace

thanks !

On Sep 20, 11:39 pm, Dan Ports <danpo...@gmail.com> wrote:
> OK. Does calling a different overload of MessageBox and providing a caption
> yield the same result? Can you test this using the latest trunk version of
> Cassia, which you can download from the build
> server<http://teamcity.codebetter.com/project.html?projectId=project51>(login
> as a guest and use the artifacts link)?
>
> Can you provide a stack trace (at least for the portions within Cassia)?
>
> Dan
>
> On Tue, Sep 20, 2011 at 5:44 PM, Alexander Wolff
> <alexander.wo...@gmail.com>wrote:
Reply all
Reply to author
Forward
0 new messages