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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:15:53+00:00 2026-05-29T21:15:53+00:00

When a users visits my home page and they click the log in button

  • 0

When a users visits my home page and they click the log in button it brings up jquery ui dialog that contains a regular form.

        @using (Html.BeginForm("LogOn", "Account", FormMethod.Post, new { @name = "user-login-form", @id = "user-login-form" }))
        {
            <fieldset style="margin: 10px 0 0 0;">
                <label for="name">
                    Username</label>
                <input type="text" name="UserName" id="username" class="text ui-widget-content ui-corner-all" />
                <label for="password">
                    Password</label>
                <input type="password" name="password" id="password" value="" class="text ui-widget-content ui-corner-all" />
            </fieldset>
        }

This form exists in a partial view that is part of the index view on the home controller. As you can see it posts to the Logon action in the Account controller. The following is that action.

    [HttpPost]
    public ActionResult LogOn(LogOnModel model, string returnUrl) // rename either the model or the view name field to match.
    {
        if (ModelState.IsValid)
        {
            if (MembershipService.ValidateUser(model.UserName, model.Password))
            {
                AuthenticationService.SignIn(model.UserName, model.RememberMe);

                if (Url.IsLocalUrl(returnUrl))
                {
                    return Redirect(returnUrl);
                }

                if (MembershipService.IsUserInRole(model.UserName, "ServiceProvider"))
                {
                    return RedirectToAction("Index", "ServiceProvider");
                }

                return RedirectToAction("Index", "Project");
             }

            ModelState.AddModelError("", "The user name or password provided is incorrect.");
        }

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

As you can see if the model is not valid it sends you to the LogOn view (not a partial) which is part of the Account controller.

The problem is … whether I fill out the form from the partial or the regular view either way I end up at the /Account/LogOn page with a 500 error. I’ve gone over it a hundred times and I can’t seem to figure out what’s going wrong. The data is correct. The user name and password are validated but I never actually make it to the Index action on the Project controller.

The index action in the Project controller exists and all it does is return View(). The Index.cshtml file does exist. Even if I remove all models and make the page as simple as possible I still end up with the same issue. Staying on the /Account/Logon page with a 500 error instead of making it to /Project/Index.

I have done some searching and did find some stuff about redirecting from ajax etc … and something saying that you shouldn’t redirect from a partial but even from the regular view it’s not working. Not sure if it could be an IIS issue or something? Definitely willing to try anything … been struggling on this for 2 days.

Thanks,

  • 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-29T21:15:55+00:00Added an answer on May 29, 2026 at 9:15 pm

    1) 500 Server error means that a script has thrown an error, this is not a broken link like 404 error.So use ‘friendly http errors’, this will give you a more comprehensive description of the error so you can debug the script.
    2) Try using Razor syntax in Mvc 3 like below or using Strongly type on view.
    3) May be your password property is wrong(it Password not password).

    @using (Html.BeginForm()) {

    <div>
        <fieldset>
            <legend>Account Information</legend>
    
            <div class="editor-label">
                @Html.LabelFor(m => m.UserName)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.UserName)
                @Html.ValidationMessageFor(m => m.UserName)
            </div>
    
            <div class="editor-label">
                @Html.LabelFor(m => m.Password)
            </div>
            <div class="editor-field">
                @Html.PasswordFor(m => m.Password)
                @Html.ValidationMessageFor(m => m.Password)
            </div>
    
    
            <p>
                <input type="submit" value="Log On" />
            </p>
        </fieldset>
    </div>
    

    }

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

Sidebar

Related Questions

does anyone know any sort of app that lets users visit a page on
I have Your latest 5 visits at the home page of the user when
I am building stats for my users and dont wish the visits from bots
I need to adjust several views in the event that a user visits my
I need to redirect a user to a different page if they visit a
I have a RoR site that loads a splash page on the first visit.
I have three pages on my site. Page 1 is home page. When user
in my master page there is a login status when i click on it
If i visit the home page on my site (which uses code igniter) my
I am developing a web site that uses a CMS and my actual home

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.