是否可以在代码后面了解页面是否在 iframe 内被调用
我需要了解页面是否在 iframe 内部被调用,或者不在代码后面调用。这可能吗?
我需要在后面的母版页代码中确定它。
ASP.NET 4.0,C#
I need to understand that whether page is being called inside iframe or not at code behind. Is this possible?
I need to determine it in master page code behind.
asp.net 4.0, C#
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一般来说,没有。
当然,您可以发出客户端脚本来检测 iframe 并使用查询字符串等重新加载页面。
In general, no.
Of course you can emit client script that detects iframe and reloads the page with e.g. a querystring.
这是不可能的。不过,有一个解决方法。您可以使用查询字符串并检查页面加载是否该查询字符串包含值,例如:
在您的
Default.aspx.cs
文件中:It's not possible. However there's a workaround this. You can use querystring and check on page load if that querystring contains value, for example:
In your
Default.aspx.cs
file: