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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:18:32+00:00 2026-05-24T01:18:32+00:00

I work in VS2010, ASP.NET MVC 2 project. The project was completed, it remains

  • 0

I work in VS2010, ASP.NET MVC 2 project. The project was completed, it remains to be revealed at the IIS, but the problems arise.
AJAX request that calls the controller method does not work on IIS, but work in VS. I do not know whether something should be included especially for IIS support of AJAX?
I need help and how to forward the request and url is interpreted as the MVC request with parameters?
I use IIS 5.

  • 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-24T01:18:32+00:00Added an answer on May 24, 2026 at 1:18 am

    You have hardcoded the urls in your javascript, haven’t you:

    $.post('/home/index', function(result) {
    
    });
    

    instead of using URL helpers:

    $.post('<%= Url.Action("index", "home") %>', function(result) {
    
    });
    

    The reason your code doesn’t work when you deployed your application in IIS is because you now have a virtual directory, like so: http://example.com/myapplication/home/index. If you hardcode the url instead of using URL helpers to generate it you end up with an AJAX request to http://example.com/home/index which of course doesn’t work as you are missing the application name.

    When working locally there is no virtual directory if you are using Visual Studio’s built-in web server and the url looks like this: http://locahost:1234/home/index.

    Personally what I would recommend you is to simply use HTML helpers to generate DOM elements such as <form> and <a> and then unobtrusively AJAXify them.

    For example you could have the following form:

    <% using (Html.BeginForm("SomeAction", "SomeController")) { %>
        ... some input fields
    <% } %>
    

    which you could AJAXify like this:

    $(function() {
        $('form').submit(function() {
            $.post(this.action, $(this).serialize(), function(result) {
                // TODO: process the results
            });
            return false;
        });
    });
    

    See how we are no longer hardcoding any urls in our javascript files? Now everything will work no matter where you host your application.

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

Sidebar

Related Questions

Why chirpy v2 (last version) does'nt work on vs2010 ASP.NET 4 but work on
I use Mac as my primary OS, but I often work on ASP.NET MVC
I have an ASP.NET MVC 2 application. Web project contains a reference to SomeProject
I recently joined a team that is working on a ASP.NET MVC project.. they
In VS2010 and ASP.NET MVC 2, it seems that client-side validation (JQuery Futures or
VS2010 Ultimate, ASP.NET MVC 3 w/Razor. I've created a custom view engine in my
Work on vs2010 ,asp.net C#.Recently I work on smtp server.Using the smtp server I
I'm going to implement an email-like page in my asp.net web project (VS2010,C#), I
ASP.NET MVC2, framework 3.5 Machine 1: dev box - Win7 Ultimate x64(IIS 7.5), VS2010
The report viewer doesn't seem to work in asp.net projects in VS 2010. You

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.