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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:35:21+00:00 2026-05-12T06:35:21+00:00

This is bizarre, I was wondering if anyone could shed some light on why

  • 0

This is bizarre, I was wondering if anyone could shed some light on why this happened.

Basically, I’ve been pulling my hair out trying to test JSONP out so I can implement a JSON web service that other sites can use. I’m doing development on localhost–specifically, Visual Studio 2008 and Visual Studio 2008’s built-in web server.

So as a JSONP test run w/ jQuery, I implemented the following:

$().ready(function() {
  debugger;
  try {
    $.getJSON("<%= new Uri(Request.Url, "/").ToString() %>XssTest?callback=?", function(data) {
        alert(data.abc);
    });
  } catch (err) {
    alert(err);
  }
});

And on the server ..

<%= Request["callback"] %>({abc : 'def'})

So what ends up happening is I set a breakpoint on the server and I get the breakpoint both on the first “debugger;” statment in the client-side script as well as on the server. The JSONP URL is indeed being invoked after the page loads. That’s working great.

The problem I was having was that the callback would never execute. I tested this in both IE8 as well as Firefox 3.5. Neither one would invoke the callback. The catch(err) was never reached, either. Nothing happened at all!

I’d been stuck on this for a week, and even tested with a manually keyed HTTP request in Telnet on the specified port to be sure that the server is returning the format…

callbackfn({abc : 'def'})

.. and it is.

Then it dawned on me, what if I change the hostname from localhost to localhost with a globalizer (‘.’), i.e http://localhost.:41559/ instead of http://localhost:41559/ (yes, adding a dot to any hostname is legal, it is to DNS what global:: is to C# namespaces). And then it worked! Internet Explorer and Firefox 3.5 finally showed me an alert message when I just added a dot.

So this makes me wonder, what is going on here? Why would late script tag generation work with an Internet hostname and not with plain localhost? Or is that the right question?

Clearly this is implemented for security reasons, but what are they trying to secure?? And, by getting it to work with a dot, did I just expose a security hole in this security feature?

By the way, my hosts file, while altered for other hosts, has nothing special going on with localhost; the default 127.0.0.1 / ::1 are still in place with no overrides below.

FOLLOW-UP: I got past this for local development purposes by adding:

127.0.0.1   local.mysite.com

.. to my hosts file, then adding the following code to my global.asax:

protected void Application_BeginRequest(object sender, EventArgs e)
{
    if (Request.Headers["Host"].Split(':')[0] == "localhost")
    {
        Response.Redirect(
            Request.Url.Scheme
            + "://"
            + "local.mysite.com"
            + ":" + Request.Url.Port.ToString()
            + Request.Url.PathAndQuery
            , true);
    }
}
  • 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-12T06:35:21+00:00Added an answer on May 12, 2026 at 6:35 am

    I’m going to throw an answer out there; after some thought I’ve reached my own conclusions.

    It could be that this is a security feature that’s implemented to try to thwart an Internet web site from invoking JSONP services running on the client machine.

    A web site could just go through a list of ports and keep invoking localhost on different ports and paths. ‘Localhost’ is one of few DNS hostnames that are dynamic in meaning depending on when and where it’s queried, making the potential targets vulnerable. And yes, the fact that appending a dot (.) to ‘localhost’ (‘localhost.’) produces a working workaround does expose a security vulnerability, but does offer a [tentative] workaround for development puposes.

    A better approach is to map the loopback IP to a new hostname entry in the hosts file so that it works locally, isn’t prone to be “fixed” by a browser update, and doesn’t work anywhere else but on the development workstation.

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

Sidebar

Related Questions

I'm running into a completely bizarre problem and am wondering if anyone has experienced
I am trying to debug this bizarre 404 error that surfaced in my Django
I ran into this bizarre pointer-less situation in my code and am now wondering
This is bizarre, but I am hoping someone can help me out. I have
I know this sounds bizarre, but I need to execute some PL/SQL where the
Greetings, I've encountered a seemingly bizarre issue, and was wondering if anyone is able
Ok this is bizarre and has been bugging me for days now.... I did
look at this bizarre result: list(db.users.find({produit_up.spec.prix:{$gte:0, $lte: 1000}}, {_id:0,produit_up:1})) Out[5]: [{u'produit_up': [{u'avatar': {u'avctype': u'image/jpeg',
I'm doing some testing and ran into this bizarre situation: The first case (assigning
I am having this bizarre error and I don't know what to do. This

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.