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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:26:17+00:00 2026-05-24T22:26:17+00:00

Step by step description: New Asp.Net MVC2 project Model: public class TestModel { public

  • 0

Step by step description:

New Asp.Net MVC2 project

Model:

public class TestModel
{
    public int Property 
    { get; set; }
}

HomeController:

[HandleError]
public class HomeController : Controller
{
    public ActionResult Index()
    {
        return View();
    }

    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult Index(TestModel model)
    {
        return Content(model.Property.ToString());
    }
} 

Index.aspx:

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<MVCTest.Models.TestModel>" %>

<!DOCTYPE html>
<script type="text/javascript" src="<%=Url.Content("~/Scripts/MicrosoftAjax.js")%>"></script>
<script type="text/javascript" src="<%=Url.Content("~/Scripts/MicrosoftMvcAjax.js")%>"></script>


<html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>Index</title>
    </head>
    <body>
    <%using( Ajax.BeginForm( "index", "home", new AjaxOptions()
                                                {
                                                    HttpMethod = "Post",
                                                    InsertionMode = InsertionMode.Replace,
                                                    UpdateTargetId = "Result"
                                                } ) ){ %>
        <div class="editor-field">
            <%=Html.TextBoxFor(model => model.Property, new {@type = "number", @step = "1"})%>
            <%=Html.ValidationMessageFor(model => model.Property)%>
        </div>

        <button type="submit" value="click Me">Click Me</button>

    <% } %>

    <div id="Result">
    </div>
    </body>
</html>

Given mvc application refuses to work properly in Chrome/Safari browsers – I receive
model.Property == 0 in my controller method on post.

When I remove html5 attributes, changing:

<%=Html.TextBoxFor(model => model.Property, new {@type = "number", @step = "1"})%>

to

<%=Html.TextBoxFor(model => model.Property)%>

it works like expected.

So what’s wrong with my ajax form with html5 attributes from Chrome/Safari’s point of view? IE/FF browsers work fine in every case.

Upd

Resulting html from fiddler:

HTTP/1.1 200 OK
Server: ASP.NET Development Server/10.0.0.0
Date: Wed, 17 Aug 2011 07:16:19 GMT
X-AspNet-Version: 4.0.30319
X-AspNetMvc-Version: 2.0
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 890
Connection: Close


    <script type="text/javascript" src="/Scripts/MicrosoftAjax.js"></script>
    <script type="text/javascript" src="/Scripts/MicrosoftMvcAjax.js"></script>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1"><title>
    Index
</title></head>
    <body>
     <form action="/" method="post" onclick="Sys.Mvc.AsyncForm.handleClick(this, new Sys.UI.DomEvent(event));" onsubmit="Sys.Mvc.AsyncForm.handleSubmit(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, httpMethod: &#39;Post&#39;, updateTargetId: &#39;SaveResultDiv&#39; });">
        <div class="editor-field">
            <input class="mybox" id="Property" name="Property" step="1" type="number" value="" />

        </div>

        <button type="submit" value="click Me">Click Me</button>

    </form>
    <div id="SaveResultDiv"></div>
    </body>
    </html>

Ajax request (Safari):

POST http://127.0.0.1:35636/ HTTP/1.1
Host: 127.0.0.1:35636
Referer: http://myapp/
Accept: */*
Accept-Language: ru-RU
Origin: http://myapp
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1
X-Requested-With: XMLHttpRequest, XMLHttpRequest
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept-Encoding: gzip, deflate
Content-Length: 31
Connection: keep-alive
Connection: keep-alive

X-Requested-With=XMLHttpRequest

Just to compare – ajax request in IE:

POST http://127.0.0.1:35636/ HTTP/1.1
Accept: */*
Accept-Language: ru
Referer: http://myapp/
x-requested-with: XMLHttpRequest, XMLHttpRequest
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E; .NET CLR 1.1.4322)
Host: 127.0.0.1:35636
Content-Length: 44
Connection: Keep-Alive
Pragma: no-cache

Property=555&X-Requested-With=XMLHttpRequest

Obviously requests in Chrome/Safari and IE/FF differ for some unknown reason. Any ideas?

  • 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-24T22:26:18+00:00Added an answer on May 24, 2026 at 10:26 pm

    Developed some workaround – migrated to MVC3 , elabled UnobtrusiveJavaScript in web.config like this:

    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    

    then threw away references to MicrosoftAjax.js and MicrosoftMvcAjax.js, instead using these ones:

       <script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery-1.4.4.min.js")%>"></script>
       <script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")%>"></script>
    

    Solved the problem, but it looks like a bug for me and I would report it to MS.

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

Sidebar

Related Questions

I would like to step through dataset designer code in an ASP.NET project. How
Using NetBeans 7.1 / GlassFish 3.1, I created a new TimerSessionBean. @Stateless public class
Is it possible to step though Classic ASP VB code without Visual interdev or
Newly added description: (sorry for not mentioning) The ApplicationController.current_account is defined as: class ApplicationController
I'm using ASP.NET MVC 3 code-first and I have added validation data annotations to
I've managed to get the Facebook iOS SDK implemented into my project quite nicely
I've started working on my master's project and decided to try something new and
We have an existing certificate issuing application (C#, ASP.NET, JavaScript) that issues certificates to
I am new to Python - be forewarned! I have a template class that
if step.include? apples or banana or cheese say yay end

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.