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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:01:23+00:00 2026-06-18T10:01:23+00:00

I’m new to ASP.NET MVC 4, I’m trying to create a simple login form

  • 0

I’m new to ASP.NET MVC 4, I’m trying to create a simple login form on jquery mobile.
I would like to create a simple jquerymobile MVC 4 page with Razor, where the page will “POST” when the user click submit.

But every time i click the “Login” button (which is the submit button), it keeps going to the “GET” action in my controller.

And firebug also showing the request as “GET”, please give help to give me some guidance on what I did wrong. 🙁

Below are my codes, Thank you in advance.

My View

@model com.mywebsite.Models.LoginModel

<div data-role="page" data-theme="a" id="main">
            <div data-role="header" id="topbar" data-theme="b">
                <a href="index.html" class="back" data-direction="reverse"></a>
                <div class="header_title">Login</div>
            </div>

  <div data-role="content" data-theme="e"  id="content">
@using (Html.BeginForm("Login", "User", FormMethod.Post, new Dictionary<string,Object> { {"enctype","multipart/form-data"}, {"data-ajax","false"}}))
{
    @Html.ValidationSummary(true, "Login failed. Check your login details.");    

    <fieldset>    
    <div class="container1 " >
    <div class="fblogin"></div>
    <div class="or">Or</div>
  <div class="container1_1">
  <legend>Login</legend>
        <div  class="textwrapper grid">
            <div class="leftcolumn"><label for="name">Email:</label></div>
            <div class="leftcolumn">                
                @Html.TextBoxFor(u => u.UserName, new Dictionary<string,Object> { {"data-theme","d"}, {"id","e"}, {"type","email"}, {"size","20"}})

            </div>
        </div>
     </div>   
        <div  class="textwrapper container1_1">
            <div class="leftcolumn"><label for="password">Password:</label></div>
            <div class="leftcolumn">
                @Html.PasswordFor(u => u.Password, new Dictionary<string,Object> { {"data-theme","d"}, {"id","p"}, {"type","password"}})
            </div>
        </div>    
    </div>   
    <input type="submit" value="Log In" rel="external" data-ajax="false" />

  <div class="fpwd"><a href="index.html" data-theme="d">Forgot Password?</a></div>
  <div class="container1">
          <div class="container1_1">
        <legend>Don't have an account yet?</legend>
        <ul data-role="listview" data-inset="true" data-theme="d" class="nopadding">
        <li ><a href="signup.html"><div class="icon_signup_list"></div>Register</a></li>
        </ul>
        </div>
  </div>
        </fieldset>
}  
<!-- end content-->
</div>

@Html.Partial("~/Views/Shared/_Footer.cshtml")
<!--end page-->
</div>

My Model (The same as the default MVC Application template)

public class LoginModel
{
    [Required]
    [Display(Name = "User name")]
    public string UserName { get; set; }

    [Required]
    [DataType(DataType.Password)]
    [Display(Name = "Password")]
    public string Password { get; set; }

    [Display(Name = "Remember me?")]
    public bool RememberMe { get; set; }
}

My Controller

public class UserController : Controller
{        
    // GET: /User/
    public ActionResult Login(string returnUrl)
    {
        return View();
    }

    // POST: /User/Login/
   [HttpPost]
    public ActionResult Login(LoginModel user)
    {
        var obj = UserModels.GetUser(user.UserName, user.Password);
        return View();
    }
 }

My Global.asax.cs

    public class MvcApplication : System.Web.HttpApplication
{
    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();

        WebApiConfig.Register(GlobalConfiguration.Configuration);
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);
        AuthConfig.RegisterAuth();


    }

    protected void Application_BeginRequest()
    {
        const string culture = "id";
        CultureInfo ci = CultureInfo.GetCultureInfo(culture);

        Thread.CurrentThread.CurrentCulture = ci;
        Thread.CurrentThread.CurrentUICulture = ci;
    }
}
  • 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-18T10:01:24+00:00Added an answer on June 18, 2026 at 10:01 am

    Found the silly mistake to my misery for the pass few days.

    Removed the tag on my _Layout and it worked.

    Thank you @onemancat for your replies, it hint me to look at other areas.

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

Sidebar

Related Questions

I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I'm trying to create an if statement in PHP that prevents a single post
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to count the length of a string with PHP. The string
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.

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.