Catching cassia errors in VB 2010

26 views
Skip to first unread message

Robert Gijsen

unread,
Dec 2, 2011, 9:39:34 AM12/2/11
to Cassia Users
Hi,
I've written a tool for non-admin users to be able to remote-assist
other users based on permissions per group, rather than per server.
Works great for what I want. To be able for Cassia to read/enumerate a
Terminal Server the user needs at least the 'query information'
permission on the RDP listener. Now when a user doesn't have that,
Visual Basic 2010 which I use crashes in an unhandeld exception.

A very basic 'proof of concept':

Dim TSManager As New TerminalServicesManager()
Dim TSServer As ITerminalServer
Dim TSSession As ITerminalServicesSession
Dim numberofsessions as integer
TSServer = TSManager.GetRemoteServer(<TSservername which you
don't have access to>)
TSServer.Open()
NumberOfSessions=TSServer.getsessions.count


This would create an exception in the last line. That's not a problem
as that user is actually not allowed to enumerate that info. But how
do I catch that error from VB? It doesn't generate an error in err.
Any help is appreciated.


Dan Ports

unread,
Dec 2, 2011, 9:46:21 AM12/2/11
to cassia...@googlegroups.com
Robert,

Are you using the legacy On Error statement in VB.NET? If so, try using a Try/Catch block instead. The exception thrown by Cassia will be of type Win32Exception.

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.


Robert Gijsen

unread,
Dec 2, 2011, 9:52:48 AM12/2/11
to Cassia Users
Ohw cr#p how insanely stupid of me... Thanks, that worked perfectly.
Guess I stared blind on this one. Thanks a lot!

On Dec 2, 3:46 pm, Dan Ports <danpo...@gmail.com> wrote:
> Robert,
>
> Are you using the legacy On Error statement in VB.NET? If so, try using a
> Try/Catch block instead. The exception thrown by Cassia will be of type
> Win32Exception.
>
> Dan
>

Dan Ports

unread,
Dec 2, 2011, 9:54:07 AM12/2/11
to cassia...@googlegroups.com
No problem.

Dan
Reply all
Reply to author
Forward
0 new messages