Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7900935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:05:26+00:00 2026-06-03T09:05:26+00:00

iam running asp.mvs web-application. its already hosted and DB is also by same hosting

  • 0

iam running asp.mvs web-application.
its already hosted and DB is also by same hosting provider.
i am trying (already 3 day) to use given connection string for transfering data from DB.
here is my method where is my connection string.
can you please take a look and see some potential mistake.
its very annoing because i cant do this simple thing.

   /// <summary>
    /// Gets connection string of Database
    /// </summary>
    /// <returns>connection string of type const</returns>
    public static string GetConnectionStringOfDatabase()
    {
        try
        {
            string cnc = @"data source=OnlineVertrag.mssql.somee.com;workstation      id=OnlineVertrag.mssql.somee.com;packet size=4096;user id="xxx";pwd="xxx";persist security info=False;initial catalog=OnlineVertrag";
            return cnc;
        }
        catch (Exception ex)
        {
            bool rethrow = ExceptionHelper.Handle(ex, "Business Logic");
            if (rethrow)
            {
                throw;
            }
        }
        return null;
    }




 public bool CheckIfUserIsActive(string username)
        {
            SqlConnection connection = new SqlConnection(SQLDataHelper.GetConnectionStringOfDatabase());

            try
            {
                connection.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = connection;
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = @"SELECT IsActive "
                                + "FROM Users "
                                + "WHERE Username = @Username";
                cmd.Parameters.Add(new SqlParameter("@Username", UserName));

                SqlDataReader reader = cmd.ExecuteReader();

                bool isActiveValueFromDataBase = false;

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        isActiveValueFromDataBase = Convert.ToBoolean(reader["IsActive"]);
                        if (isActiveValueFromDataBase == true)
                        {
                            return true;
                        }
                        return false;
                    }
                }

                reader.Close();
            }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:05:27+00:00Added an answer on June 3, 2026 at 9:05 am

    Mistake #1: Posting login information in a public forum.

    Seriously – everybody who views this page and looks at the edit history of the question can now login to your database. You should change the password ASAP.

    Mistake #2: Storing a connection string in code. As you just saw – password changes can come quite unexpectedly. Easiest way: store in the web.config and use ConfigurationManager.ConnectionStrings to access them:

    http://pietschsoft.com/post/2005/12/28/ASPNET-20-How-to-get-a-specific-ConnectionString-from-the-WebConfig-by-name.aspx

    Possible mistake #3: Try “data source=OnlineVertrag.mssql.somee.com;user id=xxx;pwd=xxx;initial catalog=OnlineVertrag”. Maybe the spaces between “workstation” and “id” are the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running an ASP.NET application. The web server is located on the same
I am trying to host an ASP.NET application that is running the Silverlight Video
I am trying to upload an ASP.NET MVC application in a shared server running
I am running an ASP.NET web application that connects to the WSS 3.0 search
I am running an ASP.NET 3.5 web application on IIS 7 on Windows Server
I am running a load test from VS 2008 on my asp.net web application.
I am running a very simple Web application (Asp.Net MVC3) on Win 7 IIS.
I am running about 10 asp.net websites on a hosted virtual server. The server
I am trying to get ASP.Net MVC 4 working on IIS6 and am running
I am trying out Silverlight's Isolated Storage feature. Currently running Silverlight thru ASP.NET page.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.