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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:29:27+00:00 2026-06-03T20:29:27+00:00

What url syntax should I be using to ensure controller actions are properly resolved

  • 0

What url syntax should I be using to ensure controller actions are properly resolved in a jQuery ajax call? For example, the following syntax to invoke Method1 on HomeController works while running site in Visual Studio:

 $.ajax({
             type: 'GET',
             url: "Home/Method1?lparam1=" + 1+ "&param2=" + 2,  // my problem
             dataType: 'json',
             cache: false,             
             success: function(){ alert("success");}
         });

But when I deploy site on IIS, I get HTTP 404 telling me controller actions can not be resolved.

TIA.

  • 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-03T20:29:29+00:00Added an answer on June 3, 2026 at 8:29 pm

    I would let MVC generate the link for you:

    url: '@Url.Action("Method1", "Home")?lparam1=' + encodeURIComponent(1) + ... 
    

    If your JS in an external file, you could set a global variable with the URL in your page and let the external file read it. Also, if your VS and IIS urls are different, you can give you site a Virtual Directory name in the project properties so that it matches your IIS directory, or better, yet, just have your project use IIS instead of Cassini (the built-in web server).

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

Sidebar

Related Questions

I'm trying to send an ajax request using jquery. From the tutorial, I try
The situation: Say I have an example controller called AccountController with some actions of
I am sending a json string using JQuery.ajax to a php page where I
This is rather a syntax question I am going to explain it jQuery's ajax
I'm sure I have seen this syntax <%= Url.Action((MyController c) => c.MyMethod(a)) %> or
URL url = new URL(http://www.example.com/comment); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setRequestMethod(POST); Is connection.setRequestProperty(key,
I'm using jQuery to show a success message after a form is submitted. The
I am following the Struts 2 Tutorial - Using Struts 2 Tags So far
I have a ruby script repeatedly executing the following the INSERT statement using the
I have following vb.net code and i am getting syntax error in it Update

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.