PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms WinForms / ODBC.net security

Reply

WinForms / ODBC.net security

 
Thread Tools Rate Thread
Old 21-01-2004, 08:40 PM   #1
John Carnahan
Guest
 
Posts: n/a
Default WinForms / ODBC.net security


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






  Reply With Quote
Old 22-01-2004, 01:53 PM   #2
Miha Markic
Guest
 
Posts: n/a
Default Re: WinForms / ODBC.net security

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
>
>
>
>
>
>



  Reply With Quote
Old 22-01-2004, 04:42 PM   #3
John Carnahan
Guest
 
Posts: n/a
Default Re: WinForms / ODBC.net security

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
> >
> >
> >
> >
> >
> >

>
>



  Reply With Quote
Old 23-01-2004, 08:53 AM   #4
Miha Markic
Guest
 
Posts: n/a
Default Re: WinForms / ODBC.net security

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
> > >
> > >
> > >
> > >
> > >
> > >

> >
> >

>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off