我可以欺骗HttpRequest.Current.Request.IsLocal吗? [英] Can I fool HttpRequest.Current.Request.IsLocal?

查看:91
本文介绍了我可以欺骗HttpRequest.Current.Request.IsLocal吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个Web应用程序,如果它是在本地运行的,则会显示一些调试行为-资源字符串周围的引号等-并且我想在我没有互联网的会议上在笔记本电脑上演示该应用程序访问权限,因此它必须是本地的.

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.

该应用程序使用HttpContext.Current.Request.IsLocal来确定它是否在本地运行-有什么方法可以欺骗它?我想欺骗它返回"False",即使我确实在本地运行.

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.

我确实可以访问源代码(并且意识到我可以演示其中注释了"IsLocal"检查的构建),但不想为此演示做特殊的构建.如果需要的话,我会做的,但是我宁愿使用现有的未修改的代码库.

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.

推荐答案

这将需要在对您的IIS本地实例的请求中欺骗一个非本地IP地址.我认为您花在制作演示版本上的时间可能会比尝试进行该工作花费的时间少.

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.

这篇关于我可以欺骗HttpRequest.Current.Request.IsLocal吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆