C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

User not trusted with a SQL server connection -


Posted Date: 03 Nov 2008      Posted By: Pradeep      Member Level: Bronze     Points: 1   Responses: 1



Hello Experts,

I am trying to authenticate my users using login control and I am getting above mentioned error.

Here is my web.config code.
<connectionStrings>
<add name="PCM" connectionString="server=DEVWSPK;database=leicestercollege;integrated security=sspi;"/>
</connectionStrings>

and here is my login.aspx.cs code

protected static Boolean Authentication(string username, string password)
{
string sqlstring;
sqlstring = "Select name, password frm ct_user where name='" + username + "' and password ='" + password + "'";

// create a connection with sqldatabase
System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(
" Data Source=DEVWSPK;Initial Catalog=leicestercollege;TrustServerCertificate=True " );

// create a sql command which will user connection string and your select statement string
System.Data.SqlClient.SqlCommand comm = new System.Data.SqlClient.SqlCommand(sqlstring,con);

// create a sqldatabase reader which will execute the above command to get the values from sqldatabase
System.Data.SqlClient.SqlDataReader reader;

// open a connection with sqldatabase
con.Open();

// execute sql command and store a return values in reade
reader = comm.ExecuteReader();

// check if reader hase any value then return true otherwise return false
if (reader.Read())
return true;
else
return false;
}





Responses

Author: D.Jeya kumar(JK)    03 Nov 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

Hi,


check the below site to know more about your problems

http://p2p.wrox.com/topic.asp?TOPIC_ID=51927

http://msdn.microsoft.com/en-us/library/ms143705.aspx

Regards
JK



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : How to get selected date value from popup form to my original form.
Previous : How can I implement Third Party blog tool im my site
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use