PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
WinForms / ODBC.net security
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
WinForms / ODBC.net security
![]() |
WinForms / ODBC.net security |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hi John,
Are you runing app from network share on production system? -- Miha Markic - RightHand .NET consulting & software development miha at rthand com www.rthand.com "John Carnahan" <carnahan_j@msn.com> wrote in message news:ed1PT7F4DHA.1700@TK2MSFTNGP11.phx.gbl... > 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 > > > > > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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 "Miha Markic" <miha at rthand com> wrote in message news:OByeM8O4DHA.488@TK2MSFTNGP12.phx.gbl... > Hi John, > > Are you runing app from network share on production system? > > -- > Miha Markic - RightHand .NET consulting & software development > miha at rthand com > www.rthand.com > > "John Carnahan" <carnahan_j@msn.com> wrote in message > news:ed1PT7F4DHA.1700@TK2MSFTNGP11.phx.gbl... > > 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 > > > > > > > > > > > > > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
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/i.../SecurityinNET/ -- Miha Markic - RightHand .NET consulting & software development miha at rthand com www.rthand.com "John Carnahan" <carnahan_j@msn.com> wrote in message news:%23dYduaQ4DHA.1504@TK2MSFTNGP12.phx.gbl... > 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 > > "Miha Markic" <miha at rthand com> wrote in message > news:OByeM8O4DHA.488@TK2MSFTNGP12.phx.gbl... > > Hi John, > > > > Are you runing app from network share on production system? > > > > -- > > Miha Markic - RightHand .NET consulting & software development > > miha at rthand com > > www.rthand.com > > > > "John Carnahan" <carnahan_j@msn.com> wrote in message > > news:ed1PT7F4DHA.1700@TK2MSFTNGP11.phx.gbl... > > > 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 > > > > > > > > > > > > > > > > > > > > > > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

