Reputation: 7585
In asp.net, is there any way to tell if a request is from "iframe"??
Thank you very much
Upvotes: 1
Views: 834
Reputation: 11
Here is the answer from javascript
var isIframe = (window.location != window.parent.location) ? true : false;
Then you can use some Ajax request, or maybe enable pageMethods and send that information server-side.
Upvotes: 1
Reputation: 6184
Not if you do not have control over the request. If someone creates an a page with an iFrame and then loads your content in it, there will be no difference in the request.
If you are making the request, then you can add a query string parameter such as ?fromIFrame=1 and tell your asp.net application that it is coming from an iFrame.
Upvotes: 3