ASP.Net 在没有表单身份验证的情况下保护我的页面

发布于 2024-08-02 00:00:03 字数 197 浏览 3 评论 0原文

我有一个具有表单身份验证的 Web 应用程序,但是其中一个页面必须通过第三方应用程序访问。 该第 3 方应用程序发送带有查询字符串参数的请求并返回数据。 此页面已设置,因此表单身份验证不适用于它。

如果有人找到第 3 方应用程序正在使用的 URL(并且发生这种情况的可能性很高)并将其放入浏览器中,我不希望此数据可用。

这怎么可能?

I have a web application which has Forms Authentication however one of the pages has to be accessed via a 3rd party application. This 3rd party app sends its request with querystring parameters and data is returned. This page has been setup so Forms Authentication does not apply to it.

I do not want this data available if someone finds the URL that the 3rd party app is using (and their is a high chance of this happening) and they put it in the browser.

How is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

饮湿 2024-08-09 00:00:03

好吧,这取决于你在那里做什么。

  1. 如果第三方应用程序始终从同一 IP 进行调用,您可以根据请求 IP 进行限制,但不是 100% 万无一失
  2. 如果您担心人们窃取链接,请不要通过查询字符串通过身份验证,因为这样他们就已经设置好了所有内容
  3. 如果第 3 方可以通过其请求传递凭据,则可能会考虑在 IIS 级别实现基本身份验证

添加详细信息

根据您的请求,这里有一个有关如何设置基本身份验证的链接。 基本 IIS 身份验证

这对于你的情况应该很有效。

Well, depending on what you are doing there a few things.

  1. If the third party application will always be calling from the same IP you could limit based on request IP, but not 100% fool-proof
  2. If you are concerned about people stealing the link DO NOT pass authentication via querystring, as then they have everything setup
  3. Potentially look at implementing basic authentication at the IIS level, if the 3rd party can pass credentials through their request

Added Detail

Per your request, here is a link on how to setup basic authentication. Basic IIS Authentication.

This should work out well in your case.

_失温 2024-08-09 00:00:03

我不知道这是否适用于您所描述的情况,但您可以尝试

MembershipUser User = Membership.GetUser();

在相关页面的 Page_Load 方法中调用并检查是否返回了有效用户。 但这可能不是一个完美的解决方案,因为它只会阻止经过身份验证的用户。

在什么情况下用户可以找到此页面的链接? 另外,您是否可以控制第 3 方应用程序发送请求的方式?

I don't know if this will work for the situation you are describing, but you might try calling

MembershipUser User = Membership.GetUser();

In your Page_Load method for the page in question and checking to see if a valid user was returned. This is probably not a perfect solution though, as it would only block authenticated users.

What are the circumstances that would allow a user to find the link to this page? Also, do you have any sort of control over how the 3rd party app is sending its request?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文