473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Visual Basic.net Security on a Network Drive

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
8 3335
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Alex Ang | last post by:
I have written the following VBScript program. It is stored into a file "map_drive.vbs". It successfully mapped to a network drive \\server1\data. Dim WshNetwork Set WshNetwork =...
1
by: Namratha Shah \(Nasha\) | last post by:
Hey Guys, Before we start with our sample app we need to view the security configuration files on the machine. You will find them under <drive>\WInNT\Microsoft.NET\FrameWork\<version>\Config ...
0
by: Michael Hauer | last post by:
Hi, First my system(s): We want to migrate one server from NT 4.0 to Linux (small company). Clients are NT + XP. The application is .NET 1.0 and all clients run 1.0 SP3. A network drive...
26
by: Bruno Jouhier [MVP] | last post by:
I'm currently experiencing a strange phenomenon: At my Office, Visual Studio takes a very long time to compile our solution (more than 1 minute for the first project). At home, Visual Studio...
2
by: elnahrawi | last post by:
Download ebook http://books-download.com/?Book=1487-Visual+Basic+2005+Jumpstart Okay, all you VB6 developers--time's up. As of March 2005, Microsoft no longer supports this version of Visual...
10
by: Richard MSL | last post by:
I am having problems working with .net security. I have been attempting to use the Microsoft .Net Framework 2.0 Configuration tool (version 2.0.50727.42), but it won't work for me. I have a simple...
6
by: alex | last post by:
Hi, this always works: private ConsoleToTextbox myConsole; Console.SetOut(myConsole); But now (a few weeks later i started this project again) i get a non handeld security exception from...
7
by: GMiller | last post by:
I am fairly new to .NET programming so this may be a simplistic question. I wrote a C# application that reads and writes files. If the program resides on a local drive everything is fine. If...
18
by: Earl Anderson | last post by:
First, I feel somewhat embarrassed and apologetic that this post is lengthy, but in an effort to furnish sufficient information (as opposed to too little information) to you, I wanted to supply all...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
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...
0
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...

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.