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 3441494
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:33:36+00:00 2026-05-18T08:33:36+00:00

I have an ASP.NET MVC application where the database is on an IBM i-Series

  • 0

I have an ASP.NET MVC application where the database is on an IBM i-Series server. I have the application development close to completion when I started to get a The ConnectionString property is invalid. error popping up:

  1. only at log on
  2. after the first successful log on after rebuilding
  3. anyone logged on can still work normally

Also, note that this problem only shows up for one project in my solution. The other project uses the exact same connection string and doesn’t have this problem (copied and pasted to be 100% sure). I am in active development on these projects, but have not touched the connections strings nor worked with the AccountController and related model classes after getting the login working.

I am using Visual Studio 2008 and .NET version 3.5.

Connection String:

<connectionStrings>
    <add name="IbmIConnectionString" connectionString="DataSource=192.168.50.200;DefaultCollection=QMFILES;Naming=sql;UserID=XXX;Password=XXXX;"/>
</connectionStrings>

Account Controller Logon method:

    [HttpPost]
    public ActionResult LogOn(LogOnModel model, string returnUrl)
    {
        string fullName = String.Empty;
        string employeeId = String.Empty;

        if (ModelState.IsValid)
        {
            if (MembershipService.ValidateUser(model.UserName, model.Password))
            {
                FormsService.SignIn(model.UserName, model.RememberMe);
                EmployeeLoginModel elm = new EmployeeLoginModel();
                elm.GetUserInfo(model.UserName, model.Password, out fullName, out employeeId);
                // Update the AuthCookie to include the last 4 digits of the SSN.
                string userDataString = String.Format("{0}|{1}|{2}", model.Password, fullName.Trim(), employeeId.Trim());
                HttpCookie authCookie = FormsAuthentication.GetAuthCookie(model.UserName, model.RememberMe);
                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
                FormsAuthenticationTicket newTicket = new FormsAuthenticationTicket(ticket.Version, ticket.Name, ticket.IssueDate, ticket.Expiration, ticket.IsPersistent, userDataString);
                authCookie.Value = FormsAuthentication.Encrypt(newTicket);
                Response.Cookies.Add(authCookie);

                if (!String.IsNullOrEmpty(returnUrl))
                {
                    return Redirect(returnUrl);
                }
                else
                {
                    return RedirectToAction("Index", "Home");
                }
            }
            else
            {
                ModelState.AddModelError("", "The user name or password provided is incorrect.");
            }
        }

        // If we got this far, something failed, redisplay form
        return View(model);
    }

Employee Login Model:

public class EmployeeLoginModel
{
    public string UserName { set; get; }
    public string Password { set; get; }

    private iDB2Connection conn;

    /// <summary>
    /// Initializes a new instance of the <see cref="EmployeeLoginModel"/> class.
    /// </summary>
    public EmployeeLoginModel()
    {
        conn = new iDB2Connection(ConfigurationManager.ConnectionStrings["IbmIConnectionString"].ConnectionString);
    }

    /// <summary>
    /// Determines whether [is valid user] [the specified username].
    /// </summary>
    /// <param name="username">The username.</param>
    /// <param name="password">The password.</param>
    /// <returns>
    ///     <c>true</c> if [is valid user] [the specified username]; otherwise, <c>false</c>.
    /// </returns>
    public bool IsValidUser(string username, string password)
    {
        int count = 0;

        // Get the data from the iSeries
        using (conn)
        {
            string sqlStatement = "SELECT COUNT(XXXXX) FROM XXXXX WHERE UPPER(XXXXXX) = @1 AND XXXXXX = @2";

            iDB2Command cmd = new iDB2Command(sqlStatement, conn);
            cmd.CommandType = CommandType.Text;
            cmd.Parameters.Add("@1", username.ToUpper());
            cmd.Parameters.Add("@2", password);
            conn.Open();
            count = (Int32)cmd.ExecuteScalar();
            conn.Close();
        }

        return ((count == 0) ? false : true);
    }
  • 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-05-18T08:33:36+00:00Added an answer on May 18, 2026 at 8:33 am

    After posting this, I had a theory. I was switching between browsers getting things setup for a demo. I changed my method to:

        public bool IsValidUser(string username, string password)
        {
            int count = 0;
    
            // Get the data from the iSeries
            using (iDB2Connection conn = new iDB2Connection(ConfigurationManager.ConnectionStrings["IbmIConnectionString"].ConnectionString))
            {
                string sqlStatement = "SELECT COUNT(XXXXXX) FROM XXXXXX WHERE UPPER(XXXXXX) = @1 AND XXXXXX = @2";
    
                iDB2Command cmd = new iDB2Command(sqlStatement, conn);
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.Add("@1", username.ToUpper());
                cmd.Parameters.Add("@2", password);
                conn.Open();
                count = (Int32)cmd.ExecuteScalar();
                conn.Close();
            }
    
            return ((count == 0) ? false : true);
        }
    

    It seems to be working now. I wonder if that was the problem.

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

Sidebar

Related Questions

I have an Asp.Net MVC application that works in the vs.net development web server.
I have an ASP.NET MVC 3 application with a SQL Server 2005 database backend.
I have an asp.net mvc 2 application with a SQL Server database accessed by
I have an ASP.NET MVC application with the default membership database. I am accessing
I have an ASP.Net MVC application and I'm using Forms authentication in SQL Server.
I have a ASP.NET MVC application and I have used Linq-to-SQL queries to get
I have a simple ASP.NET MVC 3 application. I have the database I designed
I have an ASP.NET MVC application where I am editing an existing database to
I have an asp.net mvc application, which uses the default user database. It all
I have an Asp.Net MVC 3 application with a database Consultants, accessed by EF.

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.