WinForms / ODBC.net security

  • Thread starter Thread starter John Carnahan
  • Start date Start date
J

John Carnahan

Using the ODBC.net data provider to access dbase V tables.

Everything works fine on the develpment system, but I get a security error
on the production system (running XP on both, so MDAC=2.7)

here's the code block that generates an UNHANDLED sercurity exception. I'm
not sure what type of exception to try to trap here... thought
the Security.SecurityException would catch it so I could see what is going
on, but it doesn't.

I also checked the security rights on the production machine, and to the
best I could determine, it has the rights.... but not really sure about
this.

' get the information in TALKNET.dbf

Private Function GetTalkNetInfo(ByVal connStr As String) As DataSet

lbl_usermsg.Text = "Procedure GetTalkNetInfo Retreiving data from
TALKNET.dbf: " + "connection string:" + connStr

Dim ok As Boolean = True

Dim talknetCONN As OdbcConnection = New OdbcConnection()

Dim talknetDA As OdbcDataAdapter

Dim talknetDS As DataSet = New DataSet()

talknetCONN.ConnectionString = connStr

Dim talknetQRY As String = "SELECT * FROM TALKNET WHERE THREADID=100"

talknetDA = New OdbcDataAdapter(talknetQRY, talknetCONN)

Dim talknetCMD As New OdbcCommand(talknetQRY, talknetCONN)

Try

talknetCONN.Open()

talknetDA.Fill(talknetDS, "Talknet")

Catch e As OdbcException

cRetrnmsg = e.Errors(0).Message & " " & e.Errors(0).Source

lbl_usermsg.Text = cRetrnmsg

Catch e As Exception

cRetrnmsg = " & e.Errors(0).Message & e.Errors(0).Source"

lbl_usermsg.Text = cRetrnmsg

Catch e As Security.SecurityException

cRetrnmsg = " & e.Errors(0).Message & e.Errors(0).Source"

lbl_usermsg.Text = cRetrnmsg

Finally

talknetCONN.Close()

End Try

Return talknetDS

End Function
 
Yes,
On a Mapped drive... K:\ points to "my documents\my folder" Shared
on the network
app is called from K:\myapp\myprogram.exe
john
 
Hi John,

I though so.
When assembly is run from non-local drive, the framework applies stricter
security on it (less privileges).
Consider copying all assemblies to local drive or adjust security settings
for the assemblies.
You might also read this excellent article from Don Box:
Security in .NET: The Security Infrastructure of the CLR Provides Evidence,
Policy, Permissions, and Enforcement Services
http://msdn.microsoft.com/msdnmag/issues/02/09/SecurityinNET/
 
Back
Top