使用由IP地址保护的Web服务:IP地址无法识别 [英] Consuming a web service secured by IP Address : IP address not recognized

查看:68
本文介绍了使用由IP地址保护的Web服务:IP地址无法识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我的asp.net系统必须在客户端的服务器上使用Web服务来检索XML数据。 Web服务受IP地址保护,因此只有当消费者来自已知IP地址时才会返回正确的结果。我正在开发我的asp.net系统,并且为了测试系统,我的客户端有我的公共IP地址(IP地址范围,以便其他开发人员也可以测试)将其添加到他们的IP地址列表中。我可以直接从我的浏览器访问Web服务。但是,我无法从我的asp.net代码访问Web服务。 (他们现在将我重定向到他们的登录页面而不是向我发送XML数据。)我对我的开发(本地)环境的IP地址的理解是我的asp.net系统使用本地主机但是当它到达web服务时web服务从我的公共IP地址看到我的请求。 (如localhost - >私有IP地址 - >公共IP地址)是吗?在那种情况下,我的asp.net代码中应该做些什么?或者我认为完全错了?



提前谢谢。

Hi,

My asp.net system has to consume a web service on my client''s server to retrieve XML data. The web service is secured by IP address so that it only returns the right result only when the consumer is from a known IP Address. I''m still developing my asp.net system, and for me to test the system, my client has my public IP address (range of IP address so that other developers can test as well) to add it to their IP address list. I can access to the web service directly from my browser. However, I''m not able to access to the web service from my asp.net code. (They redirect me to their login page right now instead of sending me XML data.) My understanding of IP address of my development (local) environment is that my asp.net system uses local host but when it reaches to the web service the web service sees my request as from my public IP address. (like localhost -> private ip address -> public ip address) Is that right? In that case, is there anything I should do in my asp.net code? Or am I thinking totally wrong?

Thank you in advance.

推荐答案

如果你被重定向到登录页面,这表明您需要身份验证才能访问Web服务。

当您使用浏览器进行连接时,您可以通过它,因为它会自动通过您的凭据进行身份验证。

使用Web服务器代码进行连接时,默认情况下,Web服务器会将其作为匿名请求发送。在发送之前,您需要在代码中为请求设置正确的凭据,以免受到登录的影响。
If you are being redirected to a login page, that would indicate that you need authentication to access the web service.
When you connect using your browser you are allowed through because it it passing your credentials through automatically for authentication.
When you connect using your web server code, your web server will send it as an anonymous request by default. You will need to set proper credentials on the request in your code before you send it in order not to get punted to the login.


这篇关于使用由IP地址保护的Web服务:IP地址无法识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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