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

Visual Basic.net Security on a Network Drive

P: n/a
I have a vb.net application which runs fine when
installed locally on a user machine but when the
application is run from a network drive a security
exception error occurs. I've set the intranet zone
through the .Net Configuration wizard to Full Trust and
the app still has a security exception. I've turned on
Just in Time Debugging and noticed the security exception
is happening at that below line of code.

Dim rs As New ADODB.Recordset()

Any help would be greatly appreciated.
Nov 20 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Cor
Hi Brian,
Dim rs As New ADODB.Recordset()


I can not believe it is this line of code, but nearby this line of code is
probably a line of code from the database that has to be connected, is that
not the error?

Just a thought
Cor
Nov 20 '05 #2

P: n/a
Dim rs As New ADODB.Recordset()
Dim strSQL As String
Dim strGroup As String
Dim tn As TreeViewEX.TreeNode
Dim rClickedNode As TreeViewEX.TreeNode = _
TreeViewEX1.GetNodeAt
(TreeViewEX1.PointToClient(Cursor.Position))

Try
lblVersion.Text =
Application.ProductVersion.ToString
'imgMDIMainForm.Width = gWidth
'imgMDIMainForm.Height = gHeight
SetConnection()
gWellInfo = False

rs = CreateObject("ADODB.Recordset")

The above is a piece of the coding. I set the connection
using a module called SetConnection(). The error is at
the Dim statement. If I comment out the Dim it will run
until it gets to the SetConnection called in which it
errors with a security exception. Anything dealing with
a call to ado I get the security exception. If I comment
out everything dealing with a ado call to the database
the app will run.
-----Original Message-----
Hi Brian,
Dim rs As New ADODB.Recordset()
I can not believe it is this line of code, but nearby

this line of code isprobably a line of code from the database that has to be connected, is thatnot the error?

Just a thought
Cor
.

Nov 20 '05 #3

P: n/a
Cor
Hi Brian,
If you had 5 lines of code more we could see more.
But do you have in the catch something as
Catch sqlEx As SqlException
MessageBox.Show(sqlEx.ToString, "", MessageBoxButtons.OK,
MessageBoxIcon.Error)
and
Catch ex As Exception
frmStatusMessage.Close()
MessageBox.Show(ex.Message, "", MessageBoxButtons.OK,
MessageBoxIcon.Error)

than you can maybe see than better what is the error.

You never know if you find it this way.
Cor
Nov 20 '05 #4

P: n/a
It's erroring before the try and catch. I move the try
above and still get the error on the same line. Here is
a look of how the coding is.

Private Sub frmMainMenu_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Try
Dim rs As New ADODB.Recordset()
Dim strSQL As String
Dim strGroup As String
Dim tn As TreeViewEX.TreeNode
Dim rClickedNode As TreeViewEX.TreeNode = _
TreeViewEX1.GetNodeAt
(TreeViewEX1.PointToClient(Cursor.Position))

lblVersion.Text =
Application.ProductVersion.ToString
SetConnection()
gWellInfo = False

rs = CreateObject("ADODB.Recordset")

...

rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
...
rs.Close()

...
rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
...
rs.Close()

...
rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
If Not rs.EOF Then
gGroup = "m4Admins"
End If
rs.Close()

...

rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
...
rs.Close()
rs = Nothing
Catch sqlEx As SqlException
MessageBox.Show(sqlEx.ToString, "",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
-----Original Message-----
Hi Brian,
If you had 5 lines of code more we could see more.
But do you have in the catch something as
Catch sqlEx As SqlException
MessageBox.Show(sqlEx.ToString, "", MessageBoxButtons.OK,MessageBoxIcon.Error)
and
Catch ex As Exception
frmStatusMessage.Close()
MessageBox.Show(ex.Message, "", MessageBoxButtons.OK,MessageBoxIcon.Error)

than you can maybe see than better what is the error.

You never know if you find it this way.
Cor
.

Nov 20 '05 #5

P: n/a
Cor
Brian,
If you put that normal catch before or after the catch from the sql, than
maybe you can see what happens,
Then maybe you can see the reason why there is an exception that is not a
SQL exception.
That it is at the end is not important, it is in the Try mechanism.

rs = Nothing
Catch sqlEx As SqlException
MessageBox.Show(sqlEx.ToString, "",
MessageBoxButtons.OK, MessageBoxIcon.Error) Catch ex As Exception
frmStatusMessage.Close()
MessageBox.Show(ex.Message, "", MessageBoxButtons.OK,
MessageBoxIcon.Error) End Try
End Sub
Cor

"Brian" <du*****@StoneEnergy.com> schreef in bericht
news:06****************************@phx.gbl... It's erroring before the try and catch. I move the try
above and still get the error on the same line. Here is
a look of how the coding is.

Private Sub frmMainMenu_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Try
Dim rs As New ADODB.Recordset()
Dim strSQL As String
Dim strGroup As String
Dim tn As TreeViewEX.TreeNode
Dim rClickedNode As TreeViewEX.TreeNode = _
TreeViewEX1.GetNodeAt
(TreeViewEX1.PointToClient(Cursor.Position))

lblVersion.Text =
Application.ProductVersion.ToString
SetConnection()
gWellInfo = False

rs = CreateObject("ADODB.Recordset")

...

rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
...
rs.Close()

...
rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
...
rs.Close()

...
rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
If Not rs.EOF Then
gGroup = "m4Admins"
End If
rs.Close()

...

rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
...
rs.Close()
rs = Nothing
Catch sqlEx As SqlException
MessageBox.Show(sqlEx.ToString, "",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
-----Original Message-----
Hi Brian,
If you had 5 lines of code more we could see more.
But do you have in the catch something as
Catch sqlEx As SqlException
MessageBox.Show(sqlEx.ToString, "",

MessageBoxButtons.OK,
MessageBoxIcon.Error)
and
Catch ex As Exception
frmStatusMessage.Close()
MessageBox.Show(ex.Message, "",

MessageBoxButtons.OK,
MessageBoxIcon.Error)

than you can maybe see than better what is the error.

You never know if you find it this way.
Cor
.

Nov 20 '05 #6

P: n/a
post the seConnection sub, the error is in that.
"Brian" <du*****@StoneEnergy.com> wrote in message
news:06****************************@phx.gbl...
It's erroring before the try and catch. I move the try
above and still get the error on the same line. Here is
a look of how the coding is.

Private Sub frmMainMenu_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Try
Dim rs As New ADODB.Recordset()
Dim strSQL As String
Dim strGroup As String
Dim tn As TreeViewEX.TreeNode
Dim rClickedNode As TreeViewEX.TreeNode = _
TreeViewEX1.GetNodeAt
(TreeViewEX1.PointToClient(Cursor.Position))

lblVersion.Text =
Application.ProductVersion.ToString
SetConnection()
gWellInfo = False

rs = CreateObject("ADODB.Recordset")

...

rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
...
rs.Close()

...
rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
...
rs.Close()

...
rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
If Not rs.EOF Then
gGroup = "m4Admins"
End If
rs.Close()

...

rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
...
rs.Close()
rs = Nothing
Catch sqlEx As SqlException
MessageBox.Show(sqlEx.ToString, "",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
-----Original Message-----
Hi Brian,
If you had 5 lines of code more we could see more.
But do you have in the catch something as
Catch sqlEx As SqlException
MessageBox.Show(sqlEx.ToString, "",

MessageBoxButtons.OK,
MessageBoxIcon.Error)
and
Catch ex As Exception
frmStatusMessage.Close()
MessageBox.Show(ex.Message, "",

MessageBoxButtons.OK,
MessageBoxIcon.Error)

than you can maybe see than better what is the error.

You never know if you find it this way.
Cor
.

Nov 20 '05 #7

P: n/a
Thanks for the help. The solution was with the version
of MDAC. If you don't mind I have another problem that's
happening since the ADO part is fixed. Below is another
security issue I'm have when executing the application
from a network drive

An unhandled exception of
type 'System.Security.SecurityException' occurred in
system.windows.forms.dll

Additional information: Security error.

The line of code where it errors out at follows:

Private Sub frmMain_Load(ByVal sender As Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Dim frmMainMenu As New frmMainMenu()
'Try
gForm = Me
frmMainMenu.MdiParent = Me
frmMainMenu.Show() <----THIS IS WHERE THE ERROR IS
'Catch Ex As Exception
' MessageBox.Show(Ex.Message, "",
MessageBoxButtons.OK, MessageBoxIcon.Error)
'End Try
End Sub
-----Original Message-----
Brian,
If you put that normal catch before or after the catch from the sql, thanmaybe you can see what happens,
Then maybe you can see the reason why there is an exception that is not aSQL exception.
That it is at the end is not important, it is in the Try mechanism.
rs = Nothing
Catch sqlEx As SqlException
MessageBox.Show(sqlEx.ToString, "",
MessageBoxButtons.OK, MessageBoxIcon.Error)Catch ex As Exception
frmStatusMessage.Close()
MessageBox.Show(ex.Message, "",

MessageBoxButtons.OK,MessageBoxIcon.Error)
End Try
End Sub


Cor

"Brian" <du*****@StoneEnergy.com> schreef in bericht
news:06****************************@phx.gbl...
It's erroring before the try and catch. I move the try
above and still get the error on the same line. Here is a look of how the coding is.

Private Sub frmMainMenu_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Try
Dim rs As New ADODB.Recordset()
Dim strSQL As String
Dim strGroup As String
Dim tn As TreeViewEX.TreeNode
Dim rClickedNode As TreeViewEX.TreeNode = _
TreeViewEX1.GetNodeAt
(TreeViewEX1.PointToClient(Cursor.Position))

lblVersion.Text =
Application.ProductVersion.ToString
SetConnection()
gWellInfo = False

rs = CreateObject("ADODB.Recordset")

...

rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
...
rs.Close()

...
rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
...
rs.Close()

...
rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
If Not rs.EOF Then
gGroup = "m4Admins"
End If
rs.Close()

...

rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
...
rs.Close()
rs = Nothing
Catch sqlEx As SqlException
MessageBox.Show(sqlEx.ToString, "",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
>-----Original Message-----
>Hi Brian,
>If you had 5 lines of code more we could see more.
>But do you have in the catch something as
>Catch sqlEx As SqlException
> MessageBox.Show(sqlEx.ToString, "",

MessageBoxButtons.OK,
>MessageBoxIcon.Error)
>and
>Catch ex As Exception
> frmStatusMessage.Close()
> MessageBox.Show(ex.Message, "",

MessageBoxButtons.OK,
>MessageBoxIcon.Error)
>
>than you can maybe see than better what is the error.
>
>You never know if you find it this way.
>Cor
>
>
>.
>

.

Nov 20 '05 #8

P: n/a
Cor
Brian,

I think that for Mdi forms Armin know the answers without even that he has
to think 2 seconds.
(and maybe from the netwerk problem too)
I only can go searching this newsgroup, filter the not so good answers for
you and give you the best.
But probably Armin knows this direct. (mostly he is here about 22-23GMT)
My advice.
Make a total new message.
And give the text it the subject "problem with showing MDI form"
Armin opens that always.
Success,
Cor


"Brian" <bj*****@StoneEnergy.com> schreef in bericht
news:1a*****************************@phx.gbl...
Thanks for the help. The solution was with the version
of MDAC. If you don't mind I have another problem that's
happening since the ADO part is fixed. Below is another
security issue I'm have when executing the application
from a network drive

An unhandled exception of
type 'System.Security.SecurityException' occurred in
system.windows.forms.dll

Additional information: Security error.

The line of code where it errors out at follows:

Private Sub frmMain_Load(ByVal sender As Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Dim frmMainMenu As New frmMainMenu()
'Try
gForm = Me
frmMainMenu.MdiParent = Me
frmMainMenu.Show() <----THIS IS WHERE THE ERROR IS
'Catch Ex As Exception
' MessageBox.Show(Ex.Message, "",
MessageBoxButtons.OK, MessageBoxIcon.Error)
'End Try
End Sub
-----Original Message-----
Brian,
If you put that normal catch before or after the catch

from the sql, than
maybe you can see what happens,
Then maybe you can see the reason why there is an

exception that is not a
SQL exception.
That it is at the end is not important, it is in the Try

mechanism.

rs = Nothing
Catch sqlEx As SqlException
MessageBox.Show(sqlEx.ToString, "",
MessageBoxButtons.OK, MessageBoxIcon.Error)

Catch ex As Exception
frmStatusMessage.Close()
MessageBox.Show(ex.Message, "",

MessageBoxButtons.OK,
MessageBoxIcon.Error)
End Try
End Sub


Cor

"Brian" <du*****@StoneEnergy.com> schreef in bericht
news:06****************************@phx.gbl...
It's erroring before the try and catch. I move the try
above and still get the error on the same line. Here is a look of how the coding is.

Private Sub frmMainMenu_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Try
Dim rs As New ADODB.Recordset()
Dim strSQL As String
Dim strGroup As String
Dim tn As TreeViewEX.TreeNode
Dim rClickedNode As TreeViewEX.TreeNode = _
TreeViewEX1.GetNodeAt
(TreeViewEX1.PointToClient(Cursor.Position))

lblVersion.Text =
Application.ProductVersion.ToString
SetConnection()
gWellInfo = False

rs = CreateObject("ADODB.Recordset")

...

rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
...
rs.Close()

...
rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
...
rs.Close()

...
rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
If Not rs.EOF Then
gGroup = "m4Admins"
End If
rs.Close()

...

rs.Open(strSQL, gConnection,
ADODB.CursorTypeEnum.adOpenForwardOnly)
...
rs.Close()
rs = Nothing
Catch sqlEx As SqlException
MessageBox.Show(sqlEx.ToString, "",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
>-----Original Message-----
>Hi Brian,
>If you had 5 lines of code more we could see more.
>But do you have in the catch something as
>Catch sqlEx As SqlException
> MessageBox.Show(sqlEx.ToString, "",
MessageBoxButtons.OK,
>MessageBoxIcon.Error)
>and
>Catch ex As Exception
> frmStatusMessage.Close()
> MessageBox.Show(ex.Message, "",
MessageBoxButtons.OK,
>MessageBoxIcon.Error)
>
>than you can maybe see than better what is the error.
>
>You never know if you find it this way.
>Cor
>
>
>.
>

.

Nov 20 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.