web service in asp.net that will connect to remote server with ip address, username and password

Error message:
System.Data.SqlClient.SqlException: Login failed for user ''.
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at UserData.GetUser(Int32 UserId)
   at WebService.GetUser(Int32 UserId)




web.config:
<connectionStrings>
    <clear/>
    <add name="DKMobilecs" connectionString="data source=xxx.xxx.xx.xxx;integrated security=false;Initial Catalog=DKMobile User ID=xxx; Password=xxx" providerName="System.Data.SqlClient"/>
  </connectionStrings>


userData.cs

public static User GetUser(int UserId)
    {
        SqlConnection con = new SqlConnection(Database.ConnectionString);
        con.Open();
        SqlCommand cmd = new SqlCommand("select * from DKMobile.dbo.DKMUsers where User_Id = @UserId", con);
        cmd.Parameters.AddWithValue("@UserId",UserId);
        SqlDataReader dr = cmd.ExecuteReader();
        if (dr.Read())
        {
            User u = new User();
            u.UID = (int) dr["User_ID"];
            u.UName = dr["User_Name"].ToString();
            u.UPassword = dr["Password"].ToString();
            u.UActive = (int) dr["Is_Active"];
            u.UAdmin = (int) dr["Is_Admin"];
            u.URemarks = dr["Remarks"].ToString();
            return u;
        }
        else
            return null;
    }
ankurdkAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Elizabeth AndersonCommented:
Hi,

Have you checked for the system requirements? Here's what you require for asp.net - https://msdn.microsoft.com/en-us/library/vstudio/8z6watww(v=vs.100).aspx
udaya kumar laligondlaTechnical LeadCommented:
I don't see any problem with the code, Try to connect to SQL Server with the same login credentials using  SSMS or any other client.

Check if the same connection details are passed in the line
       SqlConnection con = new SqlConnection(Database.ConnectionString);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Services

From novice to tech pro — start learning today.