Home All Groups Group Topic Archive Search About

Distributed winforms application security

Author
6 May 2005 7:18 PM
Robert
Hello all,

I am writing a small application for work that connects to a database
(located on the company network) and writes some information. We use AD for
windows auth and I have administrator staus on the domain and my development
machine. The problem lies when I attempt to run the application from another
users machine(not of administrator status on the domain), it won't allow the
connection to the database. I used the VS connection wizards to make the
connections rather than writing all the code because i didnt think it would
be a problem. Any ideas on what would be the easiest solution or which
direction to go from here? Thanks in advance.

Robert

Author
7 May 2005 1:53 PM
Nicole Calinoiu
It sounds like the most likely cause is that the users don't have adequate
permissions to the database.  To confirm whether this is the case, might you
be able to answer the following questions:

1.  Is an exception thrown when attempting to connect the the database from
the "user" machines?  If so, could you please provide the exception details?

2.  What kind of database are you using (e.g.: SQL Server, Oracle, Access,
etc.)?

3.  Are you authenticating against the database and, if so, are you using
Windows or database accounts?  (If you're not sure about the answer to this
one, please provide the database connection string, replacing any real user
credentials with garbage data.)



Show quoteHide quote
"Robert" <Rob***@discussions.microsoft.com> wrote in message
news:56F72DB6-7C8E-4C4D-9AB0-1FB391B619C4@microsoft.com...
> Hello all,
>
> I am writing a small application for work that connects to a database
> (located on the company network) and writes some information. We use AD
> for
> windows auth and I have administrator staus on the domain and my
> development
> machine. The problem lies when I attempt to run the application from
> another
> users machine(not of administrator status on the domain), it won't allow
> the
> connection to the database. I used the VS connection wizards to make the
> connections rather than writing all the code because i didnt think it
> would
> be a problem. Any ideas on what would be the easiest solution or which
> direction to go from here? Thanks in advance.
>
> Robert
Author
9 May 2005 2:08 PM
Robert
I thought the same thing at first, and as we opened the database wide open,
no one could still connect.

We are using an SQL Server DB with Active Directory Windows Auth.
I dont have the actual thrown exception, as i used a user friendly generic
try and catch exception error. The exception is thrown if it cannot write the
information to the database and the only reson it could not write is if it
was not able to connect the user.
Actually I believe It works fine with any machine on the domain with
administrator status, but i dont know what else I can change to give access.
I have tried using mscorb to give user permissions and the assembly
permissions to no avail. Any further input you could provide would be
helpful. Thanks.

Robert

My Connection string is:

this.sqlConnection1.ConnectionString = "workstation id=myworkstation;packet
size=4096;integrated security=SSPI;data source=DataSource" +
";persist security info=False;initial catalog=InitialCatalog";

Show quoteHide quote
"Nicole Calinoiu" wrote:

> It sounds like the most likely cause is that the users don't have adequate
> permissions to the database.  To confirm whether this is the case, might you
> be able to answer the following questions:
>
> 1.  Is an exception thrown when attempting to connect the the database from
> the "user" machines?  If so, could you please provide the exception details?
>
> 2.  What kind of database are you using (e.g.: SQL Server, Oracle, Access,
> etc.)?
>
> 3.  Are you authenticating against the database and, if so, are you using
> Windows or database accounts?  (If you're not sure about the answer to this
> one, please provide the database connection string, replacing any real user
> credentials with garbage data.)
>
>
>
> "Robert" <Rob***@discussions.microsoft.com> wrote in message
> news:56F72DB6-7C8E-4C4D-9AB0-1FB391B619C4@microsoft.com...
> > Hello all,
> >
> > I am writing a small application for work that connects to a database
> > (located on the company network) and writes some information. We use AD
> > for
> > windows auth and I have administrator staus on the domain and my
> > development
> > machine. The problem lies when I attempt to run the application from
> > another
> > users machine(not of administrator status on the domain), it won't allow
> > the
> > connection to the database. I used the VS connection wizards to make the
> > connections rather than writing all the code because i didnt think it
> > would
> > be a problem. Any ideas on what would be the easiest solution or which
> > direction to go from here? Thanks in advance.
> >
> > Robert
>
>
>
Author
9 May 2005 4:07 PM
Nicole Calinoiu
"Robert" <Rob***@discussions.microsoft.com> wrote in message
news:11A51733-931B-4FE8-BB77-916C3340DA3F@microsoft.com...
>I thought the same thing at first, and as we opened the database wide open,
> no one could still connect.

Could you please specify exactly what you  mean by "opened the database wide
open"?  Also, is the SQL Server machine on the domain?  Do non-admin users
(e.g.: in the Domain Users group or some other group to which your target
users belong) have permission to connect to the SQL Server?  To what
database role(s) do they belong for your target database?  Did you grant
access to the relevant database objects based on user or role (or at all)?


> We are using an SQL Server DB with Active Directory Windows Auth.
> I dont have the actual thrown exception, as i used a user friendly generic
> try and catch exception error.

Before you try to fix the problem via trial-and-error loosening of security
restrictions, I would strongly recommend that you alter your code to log the
error details to a location that you can read for troubleshooting purposes.
It is reasonably likely that the exception details would provide information
that would allow pinpointing of the exact cause of the problem.


> The exception is thrown if it cannot write the
> information to the database and the only reson it could not write is if it
> was not able to connect the user.

There are actually plenty of other potential reasons for this sort of
problem.  For example, the client machine may be unable to find the SQL
Server machine on the network, or the user may simply lack appropriate
permissions on the database object (e.g.: table or stored procedure) that
your code is attempting to use.


> Actually I believe It works fine with any machine on the domain with
> administrator status, but i dont know what else I can change to give
> access.
> I have tried using mscorb to give user permissions and the assembly
> permissions to no avail.

If it works when run as an admin on any given machine, then CAS permissions
are unlikely to be at fault.  However, it's impossible to rule out
user-level CAS policy modifications without knowing the exception details.


Show quoteHide quote
> Any further input you could provide would be
> helpful. Thanks.
>
> Robert
>
> My Connection string is:
>
> this.sqlConnection1.ConnectionString = "workstation
> id=myworkstation;packet
> size=4096;integrated security=SSPI;data source=DataSource" +
> ";persist security info=False;initial catalog=InitialCatalog";
>
> "Nicole Calinoiu" wrote:
>
>> It sounds like the most likely cause is that the users don't have
>> adequate
>> permissions to the database.  To confirm whether this is the case, might
>> you
>> be able to answer the following questions:
>>
>> 1.  Is an exception thrown when attempting to connect the the database
>> from
>> the "user" machines?  If so, could you please provide the exception
>> details?
>>
>> 2.  What kind of database are you using (e.g.: SQL Server, Oracle,
>> Access,
>> etc.)?
>>
>> 3.  Are you authenticating against the database and, if so, are you using
>> Windows or database accounts?  (If you're not sure about the answer to
>> this
>> one, please provide the database connection string, replacing any real
>> user
>> credentials with garbage data.)
>>
>>
>>
>> "Robert" <Rob***@discussions.microsoft.com> wrote in message
>> news:56F72DB6-7C8E-4C4D-9AB0-1FB391B619C4@microsoft.com...
>> > Hello all,
>> >
>> > I am writing a small application for work that connects to a database
>> > (located on the company network) and writes some information. We use AD
>> > for
>> > windows auth and I have administrator staus on the domain and my
>> > development
>> > machine. The problem lies when I attempt to run the application from
>> > another
>> > users machine(not of administrator status on the domain), it won't
>> > allow
>> > the
>> > connection to the database. I used the VS connection wizards to make
>> > the
>> > connections rather than writing all the code because i didnt think it
>> > would
>> > be a problem. Any ideas on what would be the easiest solution or which
>> > direction to go from here? Thanks in advance.
>> >
>> > Robert
>>
>>
>>
Author
10 May 2005 1:26 PM
Robert
Basically i mean we gave all permissions, as this is a non-essential machine
on the domain and used primarily as a test db and such. Security is not an
issue with this particular machine at this point. All domain users have
access to the database and have the proper permissions that the program would
require to complete it's function.The users have datareader and datawriter
roles and the DBA set up the permissions on the DB. We may try full security
admin however. These are all great questions, any more ideas? Thanks in
advance.

Show quoteHide quote
"Nicole Calinoiu" wrote:

> "Robert" <Rob***@discussions.microsoft.com> wrote in message
> news:11A51733-931B-4FE8-BB77-916C3340DA3F@microsoft.com...
> >I thought the same thing at first, and as we opened the database wide open,
> > no one could still connect.
>
> Could you please specify exactly what you  mean by "opened the database wide
> open"?  Also, is the SQL Server machine on the domain?  Do non-admin users
> (e.g.: in the Domain Users group or some other group to which your target
> users belong) have permission to connect to the SQL Server?  To what
> database role(s) do they belong for your target database?  Did you grant
> access to the relevant database objects based on user or role (or at all)?
>
>
> > We are using an SQL Server DB with Active Directory Windows Auth.
> > I dont have the actual thrown exception, as i used a user friendly generic
> > try and catch exception error.
>
> Before you try to fix the problem via trial-and-error loosening of security
> restrictions, I would strongly recommend that you alter your code to log the
> error details to a location that you can read for troubleshooting purposes.
> It is reasonably likely that the exception details would provide information
> that would allow pinpointing of the exact cause of the problem.
>
>
> > The exception is thrown if it cannot write the
> > information to the database and the only reson it could not write is if it
> > was not able to connect the user.
>
> There are actually plenty of other potential reasons for this sort of
> problem.  For example, the client machine may be unable to find the SQL
> Server machine on the network, or the user may simply lack appropriate
> permissions on the database object (e.g.: table or stored procedure) that
> your code is attempting to use.
>
>
> > Actually I believe It works fine with any machine on the domain with
> > administrator status, but i dont know what else I can change to give
> > access.
> > I have tried using mscorb to give user permissions and the assembly
> > permissions to no avail.
>
> If it works when run as an admin on any given machine, then CAS permissions
> are unlikely to be at fault.  However, it's impossible to rule out
> user-level CAS policy modifications without knowing the exception details.
>
>
> > Any further input you could provide would be
> > helpful. Thanks.
> >
> > Robert
> >
> > My Connection string is:
> >
> > this.sqlConnection1.ConnectionString = "workstation
> > id=myworkstation;packet
> > size=4096;integrated security=SSPI;data source=DataSource" +
> > ";persist security info=False;initial catalog=InitialCatalog";
> >
> > "Nicole Calinoiu" wrote:
> >
> >> It sounds like the most likely cause is that the users don't have
> >> adequate
> >> permissions to the database.  To confirm whether this is the case, might
> >> you
> >> be able to answer the following questions:
> >>
> >> 1.  Is an exception thrown when attempting to connect the the database
> >> from
> >> the "user" machines?  If so, could you please provide the exception
> >> details?
> >>
> >> 2.  What kind of database are you using (e.g.: SQL Server, Oracle,
> >> Access,
> >> etc.)?
> >>
> >> 3.  Are you authenticating against the database and, if so, are you using
> >> Windows or database accounts?  (If you're not sure about the answer to
> >> this
> >> one, please provide the database connection string, replacing any real
> >> user
> >> credentials with garbage data.)
> >>
> >>
> >>
> >> "Robert" <Rob***@discussions.microsoft.com> wrote in message
> >> news:56F72DB6-7C8E-4C4D-9AB0-1FB391B619C4@microsoft.com...
> >> > Hello all,
> >> >
> >> > I am writing a small application for work that connects to a database
> >> > (located on the company network) and writes some information. We use AD
> >> > for
> >> > windows auth and I have administrator staus on the domain and my
> >> > development
> >> > machine. The problem lies when I attempt to run the application from
> >> > another
> >> > users machine(not of administrator status on the domain), it won't
> >> > allow
> >> > the
> >> > connection to the database. I used the VS connection wizards to make
> >> > the
> >> > connections rather than writing all the code because i didnt think it
> >> > would
> >> > be a problem. Any ideas on what would be the easiest solution or which
> >> > direction to go from here? Thanks in advance.
> >> >
> >> > Robert
> >>
> >>
> >>
>
>
>
Author
10 May 2005 2:53 PM
Nicole Calinoiu
"Robert" <Rob***@discussions.microsoft.com> wrote in message
news:CC4FD780-65CB-41C1-B36B-17F7C16A258A@microsoft.com...
> Basically i mean we gave all permissions, as this is a non-essential
> machine
> on the domain and used primarily as a test db and such. Security is not an
> issue with this particular machine at this point. All domain users have
> access to the database and have the proper permissions that the program
> would
> require to complete it's function.

Or so you think.  However, if this were really the case, writing to the db
via your application would probably work for non-admins as well as it does
for admins.


> The users have datareader and datawriter
> roles and the DBA set up the permissions on the DB.

Which is fine if you're writing directly to the tables.  However, if your
application uses stored procedures, membership in these roles won't be
sufficient.


> We may try full security
> admin however.

More blind troubleshooting by loosening permissions?  Not a great idea.


> These are all great questions, any more ideas?

As I mentioned in my last post, the best approach would be to modify your
application so that the full exception details can be exposed (via UI, log,
or whatever).  The exception details should provide information that would
allow far better targeting of your troubleshooting efforts.


Show quoteHide quote
> Thanks in
> advance.
>
> "Nicole Calinoiu" wrote:
>
>> "Robert" <Rob***@discussions.microsoft.com> wrote in message
>> news:11A51733-931B-4FE8-BB77-916C3340DA3F@microsoft.com...
>> >I thought the same thing at first, and as we opened the database wide
>> >open,
>> > no one could still connect.
>>
>> Could you please specify exactly what you  mean by "opened the database
>> wide
>> open"?  Also, is the SQL Server machine on the domain?  Do non-admin
>> users
>> (e.g.: in the Domain Users group or some other group to which your target
>> users belong) have permission to connect to the SQL Server?  To what
>> database role(s) do they belong for your target database?  Did you grant
>> access to the relevant database objects based on user or role (or at
>> all)?
>>
>>
>> > We are using an SQL Server DB with Active Directory Windows Auth.
>> > I dont have the actual thrown exception, as i used a user friendly
>> > generic
>> > try and catch exception error.
>>
>> Before you try to fix the problem via trial-and-error loosening of
>> security
>> restrictions, I would strongly recommend that you alter your code to log
>> the
>> error details to a location that you can read for troubleshooting
>> purposes.
>> It is reasonably likely that the exception details would provide
>> information
>> that would allow pinpointing of the exact cause of the problem.
>>
>>
>> > The exception is thrown if it cannot write the
>> > information to the database and the only reson it could not write is if
>> > it
>> > was not able to connect the user.
>>
>> There are actually plenty of other potential reasons for this sort of
>> problem.  For example, the client machine may be unable to find the SQL
>> Server machine on the network, or the user may simply lack appropriate
>> permissions on the database object (e.g.: table or stored procedure) that
>> your code is attempting to use.
>>
>>
>> > Actually I believe It works fine with any machine on the domain with
>> > administrator status, but i dont know what else I can change to give
>> > access.
>> > I have tried using mscorb to give user permissions and the assembly
>> > permissions to no avail.
>>
>> If it works when run as an admin on any given machine, then CAS
>> permissions
>> are unlikely to be at fault.  However, it's impossible to rule out
>> user-level CAS policy modifications without knowing the exception
>> details.
>>
>>
>> > Any further input you could provide would be
>> > helpful. Thanks.
>> >
>> > Robert
>> >
>> > My Connection string is:
>> >
>> > this.sqlConnection1.ConnectionString = "workstation
>> > id=myworkstation;packet
>> > size=4096;integrated security=SSPI;data source=DataSource" +
>> > ";persist security info=False;initial catalog=InitialCatalog";
>> >
>> > "Nicole Calinoiu" wrote:
>> >
>> >> It sounds like the most likely cause is that the users don't have
>> >> adequate
>> >> permissions to the database.  To confirm whether this is the case,
>> >> might
>> >> you
>> >> be able to answer the following questions:
>> >>
>> >> 1.  Is an exception thrown when attempting to connect the the database
>> >> from
>> >> the "user" machines?  If so, could you please provide the exception
>> >> details?
>> >>
>> >> 2.  What kind of database are you using (e.g.: SQL Server, Oracle,
>> >> Access,
>> >> etc.)?
>> >>
>> >> 3.  Are you authenticating against the database and, if so, are you
>> >> using
>> >> Windows or database accounts?  (If you're not sure about the answer to
>> >> this
>> >> one, please provide the database connection string, replacing any real
>> >> user
>> >> credentials with garbage data.)
>> >>
>> >>
>> >>
>> >> "Robert" <Rob***@discussions.microsoft.com> wrote in message
>> >> news:56F72DB6-7C8E-4C4D-9AB0-1FB391B619C4@microsoft.com...
>> >> > Hello all,
>> >> >
>> >> > I am writing a small application for work that connects to a
>> >> > database
>> >> > (located on the company network) and writes some information. We use
>> >> > AD
>> >> > for
>> >> > windows auth and I have administrator staus on the domain and my
>> >> > development
>> >> > machine. The problem lies when I attempt to run the application from
>> >> > another
>> >> > users machine(not of administrator status on the domain), it won't
>> >> > allow
>> >> > the
>> >> > connection to the database. I used the VS connection wizards to make
>> >> > the
>> >> > connections rather than writing all the code because i didnt think
>> >> > it
>> >> > would
>> >> > be a problem. Any ideas on what would be the easiest solution or
>> >> > which
>> >> > direction to go from here? Thanks in advance.
>> >> >
>> >> > Robert
>> >>
>> >>
>> >>
>>
>>
>>
Author
10 May 2005 8:08 PM
Robert
Yes, you are irght, there is a problem somewhere that i am missing. I did not
mean to imply that it was ok to blind troubleshooting, just merely to rule
that part out. My application does not use any stored proc's, it merely pulls
in a dataset, makes changes to the dataset and then updates the database
given those changes in the dataset.

I did notice that anyoine else can log onto my machine (as theirself, a
non-Admin domain account) and all works fine. Strangely enough though, if i
log into another machine, the program doesnt work. I can also set up a DSN
from the user machine to the sql server and view data, so it does not appear
to be a database security issue on the surface.

I'll research more carefully the different methods of troubleshooting the
exceptions as you mentioned. Are there any good sites you recommend for this?
Thanks,

Robert

Show quoteHide quote
"Nicole Calinoiu" wrote:

> "Robert" <Rob***@discussions.microsoft.com> wrote in message
> news:CC4FD780-65CB-41C1-B36B-17F7C16A258A@microsoft.com...
> > Basically i mean we gave all permissions, as this is a non-essential
> > machine
> > on the domain and used primarily as a test db and such. Security is not an
> > issue with this particular machine at this point. All domain users have
> > access to the database and have the proper permissions that the program
> > would
> > require to complete it's function.
>
> Or so you think.  However, if this were really the case, writing to the db
> via your application would probably work for non-admins as well as it does
> for admins.
>
>
> > The users have datareader and datawriter
> > roles and the DBA set up the permissions on the DB.
>
> Which is fine if you're writing directly to the tables.  However, if your
> application uses stored procedures, membership in these roles won't be
> sufficient.
>
>
> > We may try full security
> > admin however.
>
> More blind troubleshooting by loosening permissions?  Not a great idea.
>
>
> > These are all great questions, any more ideas?
>
> As I mentioned in my last post, the best approach would be to modify your
> application so that the full exception details can be exposed (via UI, log,
> or whatever).  The exception details should provide information that would
> allow far better targeting of your troubleshooting efforts.
>
>
> > Thanks in
> > advance.
> >
> > "Nicole Calinoiu" wrote:
> >
> >> "Robert" <Rob***@discussions.microsoft.com> wrote in message
> >> news:11A51733-931B-4FE8-BB77-916C3340DA3F@microsoft.com...
> >> >I thought the same thing at first, and as we opened the database wide
> >> >open,
> >> > no one could still connect.
> >>
> >> Could you please specify exactly what you  mean by "opened the database
> >> wide
> >> open"?  Also, is the SQL Server machine on the domain?  Do non-admin
> >> users
> >> (e.g.: in the Domain Users group or some other group to which your target
> >> users belong) have permission to connect to the SQL Server?  To what
> >> database role(s) do they belong for your target database?  Did you grant
> >> access to the relevant database objects based on user or role (or at
> >> all)?
> >>
> >>
> >> > We are using an SQL Server DB with Active Directory Windows Auth.
> >> > I dont have the actual thrown exception, as i used a user friendly
> >> > generic
> >> > try and catch exception error.
> >>
> >> Before you try to fix the problem via trial-and-error loosening of
> >> security
> >> restrictions, I would strongly recommend that you alter your code to log
> >> the
> >> error details to a location that you can read for troubleshooting
> >> purposes.
> >> It is reasonably likely that the exception details would provide
> >> information
> >> that would allow pinpointing of the exact cause of the problem.
> >>
> >>
> >> > The exception is thrown if it cannot write the
> >> > information to the database and the only reson it could not write is if
> >> > it
> >> > was not able to connect the user.
> >>
> >> There are actually plenty of other potential reasons for this sort of
> >> problem.  For example, the client machine may be unable to find the SQL
> >> Server machine on the network, or the user may simply lack appropriate
> >> permissions on the database object (e.g.: table or stored procedure) that
> >> your code is attempting to use.
> >>
> >>
> >> > Actually I believe It works fine with any machine on the domain with
> >> > administrator status, but i dont know what else I can change to give
> >> > access.
> >> > I have tried using mscorb to give user permissions and the assembly
> >> > permissions to no avail.
> >>
> >> If it works when run as an admin on any given machine, then CAS
> >> permissions
> >> are unlikely to be at fault.  However, it's impossible to rule out
> >> user-level CAS policy modifications without knowing the exception
> >> details.
> >>
> >>
> >> > Any further input you could provide would be
> >> > helpful. Thanks.
> >> >
> >> > Robert
> >> >
> >> > My Connection string is:
> >> >
> >> > this.sqlConnection1.ConnectionString = "workstation
> >> > id=myworkstation;packet
> >> > size=4096;integrated security=SSPI;data source=DataSource" +
> >> > ";persist security info=False;initial catalog=InitialCatalog";
> >> >
> >> > "Nicole Calinoiu" wrote:
> >> >
> >> >> It sounds like the most likely cause is that the users don't have
> >> >> adequate
> >> >> permissions to the database.  To confirm whether this is the case,
> >> >> might
> >> >> you
> >> >> be able to answer the following questions:
> >> >>
> >> >> 1.  Is an exception thrown when attempting to connect the the database
> >> >> from
> >> >> the "user" machines?  If so, could you please provide the exception
> >> >> details?
> >> >>
> >> >> 2.  What kind of database are you using (e.g.: SQL Server, Oracle,
> >> >> Access,
> >> >> etc.)?
> >> >>
> >> >> 3.  Are you authenticating against the database and, if so, are you
> >> >> using
> >> >> Windows or database accounts?  (If you're not sure about the answer to
> >> >> this
> >> >> one, please provide the database connection string, replacing any real
> >> >> user
> >> >> credentials with garbage data.)
> >> >>
> >> >>
> >> >>
> >> >> "Robert" <Rob***@discussions.microsoft.com> wrote in message
> >> >> news:56F72DB6-7C8E-4C4D-9AB0-1FB391B619C4@microsoft.com...
> >> >> > Hello all,
> >> >> >
> >> >> > I am writing a small application for work that connects to a
> >> >> > database
> >> >> > (located on the company network) and writes some information. We use
> >> >> > AD
> >> >> > for
> >> >> > windows auth and I have administrator staus on the domain and my
> >> >> > development
> >> >> > machine. The problem lies when I attempt to run the application from
> >> >> > another
> >> >> > users machine(not of administrator status on the domain), it won't
> >> >> > allow
> >> >> > the
> >> >> > connection to the database. I used the VS connection wizards to make
> >> >> > the
> >> >> > connections rather than writing all the code because i didnt think
> >> >> > it
> >> >> > would
> >> >> > be a problem. Any ideas on what would be the easiest solution or
> >> >> > which
> >> >> > direction to go from here? Thanks in advance.
> >> >> >
> >> >> > Robert
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Author
12 May 2005 11:39 AM
Nicole Calinoiu
"Robert" <Rob***@discussions.microsoft.com> wrote in message
news:B64B282C-BCE1-415C-A587-A7BB6B264E7A@microsoft.com...
<snip>
> I did notice that anyoine else can log onto my machine (as theirself, a
> non-Admin domain account) and all works fine. Strangely enough though, if
> i
> log into another machine, the program doesnt work.

That's a bit different from the scenario you described before.  Are you sure
the other machines are using the same connection string as your machine?


> I can also set up a DSN
> from the user machine to the sql server and view data, so it does not
> appear
> to be a database security issue on the surface.
>
> I'll research more carefully the different methods of troubleshooting the
> exceptions as you mentioned. Are there any good sites you recommend for
> this?

There are many, many articles that describe error logging procedures.
However, depending on how you've already set up your error handling, adding
thorough logging may require a lot of changes to the application.  For the
moment, you might want to consider making a minimal temporary change that
would enable viewing of the exception details for this particular problem.
Changing the code that displays a user-friendly error message to one that
displays the value returned from the exception's ToString method would be
sufficient.  For example, let's say your current code looks something like
this:

try
{
    // Write to database here.
}
catch (Exception ex)
{
    MessageBox.Show("An error occurred.");
}

All you would need to do is change the line that shows the message box to
display the exception details instead.  e.g.:

....
catch (Exception ex)
{
    MessageBox.Show(ex.ToString());
}




Show quoteHide quote
> Thanks,
>
> Robert
>
> "Nicole Calinoiu" wrote:
>
>> "Robert" <Rob***@discussions.microsoft.com> wrote in message
>> news:CC4FD780-65CB-41C1-B36B-17F7C16A258A@microsoft.com...
>> > Basically i mean we gave all permissions, as this is a non-essential
>> > machine
>> > on the domain and used primarily as a test db and such. Security is not
>> > an
>> > issue with this particular machine at this point. All domain users have
>> > access to the database and have the proper permissions that the program
>> > would
>> > require to complete it's function.
>>
>> Or so you think.  However, if this were really the case, writing to the
>> db
>> via your application would probably work for non-admins as well as it
>> does
>> for admins.
>>
>>
>> > The users have datareader and datawriter
>> > roles and the DBA set up the permissions on the DB.
>>
>> Which is fine if you're writing directly to the tables.  However, if your
>> application uses stored procedures, membership in these roles won't be
>> sufficient.
>>
>>
>> > We may try full security
>> > admin however.
>>
>> More blind troubleshooting by loosening permissions?  Not a great idea.
>>
>>
>> > These are all great questions, any more ideas?
>>
>> As I mentioned in my last post, the best approach would be to modify your
>> application so that the full exception details can be exposed (via UI,
>> log,
>> or whatever).  The exception details should provide information that
>> would
>> allow far better targeting of your troubleshooting efforts.
>>
>>
>> > Thanks in
>> > advance.
>> >
>> > "Nicole Calinoiu" wrote:
>> >
>> >> "Robert" <Rob***@discussions.microsoft.com> wrote in message
>> >> news:11A51733-931B-4FE8-BB77-916C3340DA3F@microsoft.com...
>> >> >I thought the same thing at first, and as we opened the database wide
>> >> >open,
>> >> > no one could still connect.
>> >>
>> >> Could you please specify exactly what you  mean by "opened the
>> >> database
>> >> wide
>> >> open"?  Also, is the SQL Server machine on the domain?  Do non-admin
>> >> users
>> >> (e.g.: in the Domain Users group or some other group to which your
>> >> target
>> >> users belong) have permission to connect to the SQL Server?  To what
>> >> database role(s) do they belong for your target database?  Did you
>> >> grant
>> >> access to the relevant database objects based on user or role (or at
>> >> all)?
>> >>
>> >>
>> >> > We are using an SQL Server DB with Active Directory Windows Auth.
>> >> > I dont have the actual thrown exception, as i used a user friendly
>> >> > generic
>> >> > try and catch exception error.
>> >>
>> >> Before you try to fix the problem via trial-and-error loosening of
>> >> security
>> >> restrictions, I would strongly recommend that you alter your code to
>> >> log
>> >> the
>> >> error details to a location that you can read for troubleshooting
>> >> purposes.
>> >> It is reasonably likely that the exception details would provide
>> >> information
>> >> that would allow pinpointing of the exact cause of the problem.
>> >>
>> >>
>> >> > The exception is thrown if it cannot write the
>> >> > information to the database and the only reson it could not write is
>> >> > if
>> >> > it
>> >> > was not able to connect the user.
>> >>
>> >> There are actually plenty of other potential reasons for this sort of
>> >> problem.  For example, the client machine may be unable to find the
>> >> SQL
>> >> Server machine on the network, or the user may simply lack appropriate
>> >> permissions on the database object (e.g.: table or stored procedure)
>> >> that
>> >> your code is attempting to use.
>> >>
>> >>
>> >> > Actually I believe It works fine with any machine on the domain with
>> >> > administrator status, but i dont know what else I can change to give
>> >> > access.
>> >> > I have tried using mscorb to give user permissions and the assembly
>> >> > permissions to no avail.
>> >>
>> >> If it works when run as an admin on any given machine, then CAS
>> >> permissions
>> >> are unlikely to be at fault.  However, it's impossible to rule out
>> >> user-level CAS policy modifications without knowing the exception
>> >> details.
>> >>
>> >>
>> >> > Any further input you could provide would be
>> >> > helpful. Thanks.
>> >> >
>> >> > Robert
>> >> >
>> >> > My Connection string is:
>> >> >
>> >> > this.sqlConnection1.ConnectionString = "workstation
>> >> > id=myworkstation;packet
>> >> > size=4096;integrated security=SSPI;data source=DataSource" +
>> >> > ";persist security info=False;initial catalog=InitialCatalog";
>> >> >
>> >> > "Nicole Calinoiu" wrote:
>> >> >
>> >> >> It sounds like the most likely cause is that the users don't have
>> >> >> adequate
>> >> >> permissions to the database.  To confirm whether this is the case,
>> >> >> might
>> >> >> you
>> >> >> be able to answer the following questions:
>> >> >>
>> >> >> 1.  Is an exception thrown when attempting to connect the the
>> >> >> database
>> >> >> from
>> >> >> the "user" machines?  If so, could you please provide the exception
>> >> >> details?
>> >> >>
>> >> >> 2.  What kind of database are you using (e.g.: SQL Server, Oracle,
>> >> >> Access,
>> >> >> etc.)?
>> >> >>
>> >> >> 3.  Are you authenticating against the database and, if so, are you
>> >> >> using
>> >> >> Windows or database accounts?  (If you're not sure about the answer
>> >> >> to
>> >> >> this
>> >> >> one, please provide the database connection string, replacing any
>> >> >> real
>> >> >> user
>> >> >> credentials with garbage data.)
>> >> >>
>> >> >>
>> >> >>
>> >> >> "Robert" <Rob***@discussions.microsoft.com> wrote in message
>> >> >> news:56F72DB6-7C8E-4C4D-9AB0-1FB391B619C4@microsoft.com...
>> >> >> > Hello all,
>> >> >> >
>> >> >> > I am writing a small application for work that connects to a
>> >> >> > database
>> >> >> > (located on the company network) and writes some information. We
>> >> >> > use
>> >> >> > AD
>> >> >> > for
>> >> >> > windows auth and I have administrator staus on the domain and my
>> >> >> > development
>> >> >> > machine. The problem lies when I attempt to run the application
>> >> >> > from
>> >> >> > another
>> >> >> > users machine(not of administrator status on the domain), it
>> >> >> > won't
>> >> >> > allow
>> >> >> > the
>> >> >> > connection to the database. I used the VS connection wizards to
>> >> >> > make
>> >> >> > the
>> >> >> > connections rather than writing all the code because i didnt
>> >> >> > think
>> >> >> > it
>> >> >> > would
>> >> >> > be a problem. Any ideas on what would be the easiest solution or
>> >> >> > which
>> >> >> > direction to go from here? Thanks in advance.
>> >> >> >
>> >> >> > Robert
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>
Author
12 May 2005 12:12 PM
Robert
I finally figured it out after using different exception coding as you
suggested. It just so happens that the machine only had MDAC version 2.52.
Upgraded the machine to 2.8 and all is fine. Thanks for the help

Show quoteHide quote
"Nicole Calinoiu" wrote:

> "Robert" <Rob***@discussions.microsoft.com> wrote in message
> news:B64B282C-BCE1-415C-A587-A7BB6B264E7A@microsoft.com...
> <snip>
> > I did notice that anyoine else can log onto my machine (as theirself, a
> > non-Admin domain account) and all works fine. Strangely enough though, if
> > i
> > log into another machine, the program doesnt work.
>
> That's a bit different from the scenario you described before.  Are you sure
> the other machines are using the same connection string as your machine?
>
>
> > I can also set up a DSN
> > from the user machine to the sql server and view data, so it does not
> > appear
> > to be a database security issue on the surface.
> >
> > I'll research more carefully the different methods of troubleshooting the
> > exceptions as you mentioned. Are there any good sites you recommend for
> > this?
>
> There are many, many articles that describe error logging procedures.
> However, depending on how you've already set up your error handling, adding
> thorough logging may require a lot of changes to the application.  For the
> moment, you might want to consider making a minimal temporary change that
> would enable viewing of the exception details for this particular problem.
> Changing the code that displays a user-friendly error message to one that
> displays the value returned from the exception's ToString method would be
> sufficient.  For example, let's say your current code looks something like
> this:
>
> try
> {
>     // Write to database here.
> }
> catch (Exception ex)
> {
>     MessageBox.Show("An error occurred.");
> }
>
> All you would need to do is change the line that shows the message box to
> display the exception details instead.  e.g.:
>
> ....
> catch (Exception ex)
> {
>     MessageBox.Show(ex.ToString());
> }
>
>
>
>
> > Thanks,
> >
> > Robert
> >
> > "Nicole Calinoiu" wrote:
> >
> >> "Robert" <Rob***@discussions.microsoft.com> wrote in message
> >> news:CC4FD780-65CB-41C1-B36B-17F7C16A258A@microsoft.com...
> >> > Basically i mean we gave all permissions, as this is a non-essential
> >> > machine
> >> > on the domain and used primarily as a test db and such. Security is not
> >> > an
> >> > issue with this particular machine at this point. All domain users have
> >> > access to the database and have the proper permissions that the program
> >> > would
> >> > require to complete it's function.
> >>
> >> Or so you think.  However, if this were really the case, writing to the
> >> db
> >> via your application would probably work for non-admins as well as it
> >> does
> >> for admins.
> >>
> >>
> >> > The users have datareader and datawriter
> >> > roles and the DBA set up the permissions on the DB.
> >>
> >> Which is fine if you're writing directly to the tables.  However, if your
> >> application uses stored procedures, membership in these roles won't be
> >> sufficient.
> >>
> >>
> >> > We may try full security
> >> > admin however.
> >>
> >> More blind troubleshooting by loosening permissions?  Not a great idea.
> >>
> >>
> >> > These are all great questions, any more ideas?
> >>
> >> As I mentioned in my last post, the best approach would be to modify your
> >> application so that the full exception details can be exposed (via UI,
> >> log,
> >> or whatever).  The exception details should provide information that
> >> would
> >> allow far better targeting of your troubleshooting efforts.
> >>
> >>
> >> > Thanks in
> >> > advance.
> >> >
> >> > "Nicole Calinoiu" wrote:
> >> >
> >> >> "Robert" <Rob***@discussions.microsoft.com> wrote in message
> >> >> news:11A51733-931B-4FE8-BB77-916C3340DA3F@microsoft.com...
> >> >> >I thought the same thing at first, and as we opened the database wide
> >> >> >open,
> >> >> > no one could still connect.
> >> >>
> >> >> Could you please specify exactly what you  mean by "opened the
> >> >> database
> >> >> wide
> >> >> open"?  Also, is the SQL Server machine on the domain?  Do non-admin
> >> >> users
> >> >> (e.g.: in the Domain Users group or some other group to which your
> >> >> target
> >> >> users belong) have permission to connect to the SQL Server?  To what
> >> >> database role(s) do they belong for your target database?  Did you
> >> >> grant
> >> >> access to the relevant database objects based on user or role (or at
> >> >> all)?
> >> >>
> >> >>
> >> >> > We are using an SQL Server DB with Active Directory Windows Auth.
> >> >> > I dont have the actual thrown exception, as i used a user friendly
> >> >> > generic
> >> >> > try and catch exception error.
> >> >>
> >> >> Before you try to fix the problem via trial-and-error loosening of
> >> >> security
> >> >> restrictions, I would strongly recommend that you alter your code to
> >> >> log
> >> >> the
> >> >> error details to a location that you can read for troubleshooting
> >> >> purposes.
> >> >> It is reasonably likely that the exception details would provide
> >> >> information
> >> >> that would allow pinpointing of the exact cause of the problem.
> >> >>
> >> >>
> >> >> > The exception is thrown if it cannot write the
> >> >> > information to the database and the only reson it could not write is
> >> >> > if
> >> >> > it
> >> >> > was not able to connect the user.
> >> >>
> >> >> There are actually plenty of other potential reasons for this sort of
> >> >> problem.  For example, the client machine may be unable to find the
> >> >> SQL
> >> >> Server machine on the network, or the user may simply lack appropriate
> >> >> permissions on the database object (e.g.: table or stored procedure)
> >> >> that
> >> >> your code is attempting to use.
> >> >>
> >> >>
> >> >> > Actually I believe It works fine with any machine on the domain with
> >> >> > administrator status, but i dont know what else I can change to give
> >> >> > access.
> >> >> > I have tried using mscorb to give user permissions and the assembly
> >> >> > permissions to no avail.
> >> >>
> >> >> If it works when run as an admin on any given machine, then CAS
> >> >> permissions
> >> >> are unlikely to be at fault.  However, it's impossible to rule out
> >> >> user-level CAS policy modifications without knowing the exception
> >> >> details.
> >> >>
> >> >>
> >> >> > Any further input you could provide would be
> >> >> > helpful. Thanks.
> >> >> >
> >> >> > Robert
> >> >> >
> >> >> > My Connection string is:
> >> >> >
> >> >> > this.sqlConnection1.ConnectionString = "workstation
> >> >> > id=myworkstation;packet
> >> >> > size=4096;integrated security=SSPI;data source=DataSource" +
> >> >> > ";persist security info=False;initial catalog=InitialCatalog";
> >> >> >
> >> >> > "Nicole Calinoiu" wrote:
> >> >> >
> >> >> >> It sounds like the most likely cause is that the users don't have
> >> >> >> adequate
> >> >> >> permissions to the database.  To confirm whether this is the case,
> >> >> >> might
> >> >> >> you
> >> >> >> be able to answer the following questions:
> >> >> >>
> >> >> >> 1.  Is an exception thrown when attempting to connect the the
> >> >> >> database
> >> >> >> from
> >> >> >> the "user" machines?  If so, could you please provide the exception
> >> >> >> details?
> >> >> >>
> >> >> >> 2.  What kind of database are you using (e.g.: SQL Server, Oracle,
> >> >> >> Access,
> >> >> >> etc.)?
> >> >> >>
> >> >> >> 3.  Are you authenticating against the database and, if so, are you
> >> >> >> using
> >> >> >> Windows or database accounts?  (If you're not sure about the answer
> >> >> >> to
> >> >> >> this
> >> >> >> one, please provide the database connection string, replacing any
> >> >> >> real
> >> >> >> user
> >> >> >> credentials with garbage data.)
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> "Robert" <Rob***@discussions.microsoft.com> wrote in message
> >> >> >> news:56F72DB6-7C8E-4C4D-9AB0-1FB391B619C4@microsoft.com...
> >> >> >> > Hello all,
> >> >> >> >
> >> >> >> > I am writing a small application for work that connects to a
> >> >> >> > database
> >> >> >> > (located on the company network) and writes some information. We
> >> >> >> > use
> >> >> >> > AD
> >> >> >> > for
> >> >> >> > windows auth and I have administrator staus on the domain and my
> >> >> >> > development
> >> >> >> > machine. The problem lies when I attempt to run the application
> >> >> >> > from
> >> >> >> > another
> >> >> >> > users machine(not of administrator status on the domain), it
> >> >> >> > won't
> >> >> >> > allow
> >> >> >> > the
> >> >> >> > connection to the database. I used the VS connection wizards to
> >> >> >> > make
> >> >> >> > the
> >> >> >> > connections rather than writing all the code because i didnt
> >> >> >> > think
> >> >> >> > it
> >> >> >> > would
> >> >> >> > be a problem. Any ideas on what would be the easiest solution or
> >> >> >> > which
> >> >> >> > direction to go from here? Thanks in advance.
> >> >> >> >
> >> >> >> > Robert
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>