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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:25:55+00:00 2026-06-04T17:25:55+00:00

I have an ASP.NET MVC3 application published to a url like this: http://servername.com/Applications/ApplicationName/ In

  • 0

I have an ASP.NET MVC3 application published to a url like this:

http://servername.com/Applications/ApplicationName/

In my code, I am using jquery ajax requests like this:

$.get(('a/b/c'), function (data) {}, "json");

When I run the application locally, the ajax request goes directly to the correct page (being an mvc route) because the local page ends with a “/” (localhost/a/b/c).

However, when I publish to http://servername.com/Applications/ApplicationName/, the trailing “/” is not always present. The url could be http://servername.com/Applications/ApplicationName, which then causes the ajax request to try to load http://servername.com/Applications/ApplicationNamea/b/c, which fails for obvious reasons.

I have already looked into rewriting the url to append a trailing slash, but A) It didn’t work, and B) I feel like it’s a poor solution to the problem, and that it would be better to configure the javascript urls to work properly regardless of the local folder setup.

I did try “../a/b/c” and “/a/b/c”, but neither seemed to work.

Thanks in advance for the help!

  • 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-04T17:25:58+00:00Added an answer on June 4, 2026 at 5:25 pm

    Personally I tend to use a global variable of the relative URL of the server in my view like:

    var BASE_URL = '@Url.Content("~/")';
    

    Then you can do things like :

    $.get(BASE_URL + 'a/b/c'), function (data) {}, "json");
    

    I would like to add that if you want it to be totally global, you could add it to your /Views/Shared/_Layout.cshtml instead.

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

Sidebar

Related Questions

This is about asp.net mvc3 web application. We have used Object cache to store
Well, this is an interesting problem. I have an ASP.NET MVC3 Intranet application running
I have a Razor view in my asp.net MVC3 application with a dropdownlist like
In an ASP.NET MVC3 application I have a function that looks like: Public Sub
I have following code in my asp.net MVC3 application: string msg = Beginning report
I am designing an ASP.NET MVC3 application, and I would like to have a
I have an ASP.NET MVC3 application, where I use Entity Framework 4.3 Code-First and
I have a ASP.NET MVC3 application that handles time-consuming processes (copying a large file
I am creating an ASP.NET MVC3 application using NHIBERNATE. I have a base class
I have an ASP.NET MVC 3 application. This application requests records through jQuery. jQuery

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.