Saturday, March 24, 2012

Permission issue with SQLDataSource?

I'd like a small overview of requirements for inserting data into a
database with SQLDataSource in regards to permissions. In the
Page_Load(), my code looks similar to this (sorry, I don't have the
code with me now):

SqlDataSource mysource = new SqlDataSource("SQLClient", myconn,
CommandType.Text );
mysource.Insert( );

The above works fine when I'm local (192.168.1.100) but once I try to
access from the outside, it fails. I'm guessing perhaps because some
type of ASPNET user is not added into SQL Server 2005 users and does
not have access to the table. What are the correct steps to allow the
code to run?

I will be using a stored procedure in place of text.

Thanks,
johnYour guess sounds right. You need to setup proper database connection.
Either introduce the asp.net user to the sql server and use windows
authentication or use sql authentication with user name and password.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"perplexed" <johnc@.bigstring.comwrote in message
news:1169592074.377111.113560@.j27g2000cwj.googlegr oups.com...

Quote:

Originally Posted by

I'd like a small overview of requirements for inserting data into a
database with SQLDataSource in regards to permissions. In the
Page_Load(), my code looks similar to this (sorry, I don't have the
code with me now):
>
SqlDataSource mysource = new SqlDataSource("SQLClient", myconn,
CommandType.Text );
mysource.Insert( );
>
The above works fine when I'm local (192.168.1.100) but once I try to
access from the outside, it fails. I'm guessing perhaps because some
type of ASPNET user is not added into SQL Server 2005 users and does
not have access to the table. What are the correct steps to allow the
code to run?
>
I will be using a stored procedure in place of text.
>
Thanks,
john
>


Thanks. I added correct permissions for network service account.
That's ok since this is local.

0 comments:

Post a Comment