views:

543

answers:

2

I'm running a web application that displays some debugging behavior if it's being run locally - quotes around resource strings, etc - and I'd like to demo the application on my laptop at a conference where I won't have internet access, so it has to be local.

The application uses HttpContext.Current.Request.IsLocal to determine if it's running locally - is there any way to fool it? I'd like to trick it into returning "False" even though I am indeed running locally.

I do have access to the source code (and realize I could just demo a build where the "IsLocal" check is commented out), but would rather not make a special build for this demo. If need be, I'll do that, but I'd rather use the existing codebase untouched.

A: 

That would require spoofing a non-local IP address in requests to your local instance of IIS. I think you'd probably spend less time just making a demo build than trying to make that work.

Rex M
That's what I was afraid of, but I was thinking I'd have to go that route. I just thought there might be something quick I'd overlooked.
rwmnau
+1  A: 

I believe this is true, but cannot verify right now.

IsLocal returns True when the site is bound to the loopback address 127.0.0.1.

If you make sure in IIS that your website is bound to one of your machine's non-loopback addresses (i.e. 192.168.1.100), then IsLocal should return False.

Cassini, by definition, is always local, since it can only bind to the loopback address.

Portman
I had a glimmer of hope, but this doesn't seem to work in my environment - either IIS6 or 7. Can you please give this a shot when you have a chance, and if you can get it to work, I'd love to know how.
rwmnau