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

  • Home
  • SEARCH
  • 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 6927931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:07:07+00:00 2026-05-27T11:07:07+00:00

It appears as if my client validation is not validating properly. On my log

  • 0

It appears as if my client validation is not validating properly.

On my log on screen, when I set my username and password and submit the form is cleared and the validation message appears for required fields and the form is not always posted. why do validation clear my fields and say that they are empty?

also sometimes the form is posted but with blank fields so model binding fails on the server

the even weirder part is that i have disabled client side validation and still it fails on my production server

Everything is fine in dev

Update :
my action are already seperated, even different action names

[HttpGet]
        public ActionResult LogOn()
        {
            LogOnModel model = new LogOnModel() { UserName = "", Password = "" };
            return View(model);
            //return View();
        }

  [HttpPost]
  public ActionResult LogIn(LogOnModel model, FormCollection fcol/*, string returnUrl*/)
        {
            //Request.Form.Count
            StringBuilder sb = new StringBuilder();
            sb.Append("<br/>Form collection: ");
            if (Request.Form.Count > 0)
            {

                NameValueCollection form = Request.Form;
                sb.Append("<Form collection>");
                for (int i = 0; i < fcol.Count; i++)
                    sb.AppendFormat("{0}:{1},", fcol.AllKeys[i].ToString(), fcol[i].ToString());
                sb.Append("</Form collection>");
            }
            sb.Append("<br/>Form : ");
            if (Request.Form.Count > 0)
            {
                NameValueCollection form = Request.Form;
                sb.Append("<form>");
                for (int i = 0; i < form.Count; i++)
                    sb.AppendFormat("{0}:{1},", form.AllKeys[i].ToString(), form[i].ToString());
                sb.Append("</form>");
            }
            sb.Append("<br/>QueryString : ");
            if (Request.Form.Count > 0)
            {
                NameValueCollection form = Request.QueryString;
                sb.Append("<QueryString>");
                for (int i = 0; i < form.Count; i++)
                    sb.AppendFormat("{0}:{1},", form.AllKeys[i].ToString(), form[i].ToString());
                sb.Append("</QueryString>");
            }
            if (model != null)
            {
                sb.Append("<br/>Profile(ProfileModel m) : ");
                sb.AppendFormat("m.username = {0}, m.password = {1}", model.UserName, model.Password);
            }
            if (!ModelState.IsValid)
            {
                sb.Append("<br/>Model errors :");
                var errors = from key in ModelState
                             let errorList = ModelState[key.Key].Errors
                             where errorList.Any()
                             select new
                             {
                                 Item = key.Key,
                                 Value = key.Value,
                                 errorList
                             };

                foreach (var errorList in errors)
                {
                    sb.AppendFormat(@"<br/>MODEL ERROR: [{0}] value:'{1}' ", errorList.Item, errorList.Value);
                    foreach (var error in errorList.errorList)
                    {
                        sb.AppendFormat(" ERROR message: [{0}] exception : '{1}'", error.ErrorMessage, error.Exception);
                    }
                }
            }
            Response.Write(sb);
            //return new ContentResult();
            if (model != null)
                Log(new Exception(string.Format("model username : {0}, password : {1}, request[username] {2} , request[password] : {3}", model.UserName, model.Password, Request["UserName"], Request["Password"])));
            try
            {
                if (ModelState.IsValid)
                {
                    Log(new Exception(string.Format("ModelState {0}", ModelState.IsValid)));
                    Log(new Exception(string.Format("credentials {0},{1}", model.UserName, model.Password)));
                    if (MembershipService.ValidateUser(model.UserName, model.Password))
                    {
                        Log(new Exception(string.Format("MembershipService.ValidateUser {0},{1}", model.UserName, model.Password)));

                        FormsService.SignIn(model.UserName, false/* model.RememberMe*/);
                        Log(new Exception(string.Format("FormsService.SignIn {0},{1}", model.UserName, model.Password)));

                        //if (Url.IsLocalUrl(returnUrl))
                        //    return Redirect(returnUrl);
                        //else
                        return RedirectToAction("Index", "Home");
                    }
                    else
                        ModelState.AddModelError("", "The user name or password provided is incorrect.");
                }
            }
            catch (Exception ex)
            {
                Elmah.SqlErrorLog.GetDefault(System.Web.HttpContext.Current).Log(new Elmah.Error(ex, System.Web.HttpContext.Current));
            }
            // If we got this far, something failed, redisplay form
            return View("LogOn", model);
        }

and yes my razor page has validation summary

@Html.ValidationSummary(false, @LocalDealsResources.Strings.LogOnUnsuccessful)
@using (Html.BeginForm("LogIn", "Account"))
{
    <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, new { style = " width:200px" })
                @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, new { style = " width:200px" })
                @Html.ValidationMessageFor(m => m.Password)
            </div>
            <p>
                <input type="submit" value="@LocalDealsResources.Strings.LogOn" />
            </p>
        </fieldset>
    </div>
}

give the form a try
http://dealze.com.sapin.arvixe.com/Account/Logon

  • 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-27T11:07:07+00:00Added an answer on May 27, 2026 at 11:07 am

    I finally found what was causing this

    In my application_beginrequest I log the info on a different thread, I guess the application continued running on that thread and could not find the Request in the context

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

Sidebar

Related Questions

I have an HTML5 form that uses JavaScript for the client side validation. If
Google Chrome appears to proactively enforce client-side validation. Here is an example of what
With client-side validation turned on in ASP.NET MVC 2 RC2, the validation summary message
I've wrapped my wcf client in a IDisposable wrapper and everything appears to work
Appears that WAS does not support the integration binding. I've tried setting it up
I would like to disable client side validation on certain fields in my user
I'm trying to use httplib's HTTPSConnection for client validation, using a PKCS #12 certificate.
Following the article http://www.thekip.nl/2011/09/22/using-fluentvalidation-for-both-domain-validation-and-validation-in-mvc-projects/ for me it's not still clear where does the validation
I want as well as Client Side Validation as Server Side Validation. I realized
I want to have the ValidationSummary errors displayed during Client Side validation. Currently the

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.