0

In my submit of my login form which is in pop-up it is not hitting the controller even though I provided the code in beginform with post method. I need to send the username and password to my controller for verification. Unable to figure out why it is not hitting.

[HttpPost]
    public ActionResult LoginUser(UserInfo objUser)
    {

        int res = udaObj.CheckUser(objUser.UserName, objUser.Password);
        if (res >= 1)
        {
           return RedirectToAction("Appointment", "Home");
        }           
        else
        {
            //For testing purpose
            return RedirectToAction("Appointment", "Home");
        }
    }

My view is as follows:

 @using (Html.BeginForm("LoginUser", "Home", FormMethod.Post, new { id = "loginForm" }))
                {
                    <div class="tab-pane fade active in" id="signin">
                        <fieldset>
                            <!-- Sign In Form -->
                            <!-- Text input-->
                            <div class="control-group">
                                <label class="control-label" for="userid">Alias:</label>
                                <div class="controls">
                                   @* <input required="" id="userid" name="userid" type="text" class="form-control" placeholder="JoeSixpack" class="input-medium" required="">*@
                                     @Html.TextBoxFor(x => x.UserName, new { @class = "form-control input-large", @placeholder = "Joek@irawath.com", @required = "" , @id="userid" })
                                </div>
                            </div>

                            <!-- Password input-->
                            <div class="control-group">
                                <label class="control-label" for="passwordinput">Password:</label>
                                <div class="controls">
                                    @*<input required="" id="passwordinput" name="passwordinput" class="form-control" type="password" placeholder="********" class="input-medium">*@
                                     @Html.TextBoxFor(x => x.Password, new { @class = "form-control input-large", @placeholder = "********", @required = "", @type = "password" , @id="passwordinput" })
                                </div>
                            </div>

                            <!-- Multiple Checkboxes (inline) -->
                            <div class="control-group">
                                <label class="control-label" for="rememberme"></label>
                                <div class="controls">
                                    <label class="checkbox inline" for="rememberme-0">
                                        <input type="checkbox" name="rememberme" id="rememberme-0" value="Remember me" style="margin-left: 0px">
                                        Remember me
                                    </label>
                                </div>
                            </div>
                            <button id="btnsignin" type="submit" name="signin" class="btn btn-success">Sign In</button>
                            <!-- Button -->
                            <div class="control-group">
                                <label class="control-label" for="signin"></label>
                                <div class="controls">
                                    @* <button id="btnsignin" type="submit" name="signin" class="btn btn-success">Sign In</button>*@
                                </div>
                            </div>
                        </fieldset>
                    </div>
                }
Cœur
  • 37,241
  • 25
  • 195
  • 267
Srikanth Reddy
  • 447
  • 1
  • 8
  • 23

1 Answers1

0

Check if the object UserInfo is the same model you are using in your view. Try using a FormCollection instead and check.

Sameer
  • 383
  • 1
  • 10