Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 830737 - Last Review: May 17, 2007 - Revision: 2.4
PRB: iframe Object Source Is Cached in the Design View of an HTML Page in Visual C# .NET
You may create an HTML page in Microsoft Visual Studio .NET by using Visual C# .NET,
and then add an
iframe element with the
src attribute with the value of
http://www.ValidURL.com, where
http://www.ValidURL.com is the URL of a valid Web site.
When you change the value of the
src attribute to the name of the container page (the name of the HTML
page itself), and then switch to Design view,
you may notice the cached content in the
iframe object.
Note You may notice the same behavior when you delete an HTML page
that has an
iframe element, and then create another HTML page that has an
iframe element.
To work around this problem, refresh the HTML page in the
Design view.
This
behavior is by design.
Steps to Reproduce the Behavior
Microsoft Visual Studio .NET caches the source for an
iframe object in the Design view of an HTML page in either of the
following scenarios.
When You Modify the Value of the src Attribute in an HTML Page
- Start Visual Studio .NET.
- Use Microsoft Visual C# .NET to create an ASP.NET Web
Application project that is named Iframetest.
- In Solution Explorer, right-click
Iframetest, point to Add, and then click
Add HTML Page.
- In the Add New Item - Iframetest dialog
box, click Open. By default, the
HTMLPage1.htm page is created.
- Right-click in the Design view of the HTMLPage1.htm page,
and then click View HTML Source.
- Replace the existing code with the following code to add
an iframe element to the HTMLPage1.htm page:
<html>
<head>
<title>HTMLPage1</title>
</head>
<body MS_POSITIONING="GridLayout">
<iframe id="iframe1" src="http://www.ValidURL.com"></iframe>
</body>
</html>
- On the File menu, click Save
HTMLPage1.htm.
- Right-click in the HTML view of the HTMLPage1.htm page, and
then click View Design. You may notice that the
http://www.ValidURL.com Web page is displayed in the iframe object.
- Switch to HTML view, and then modify the value of the src attribute of the iframe element as follows:
<iframe id="iframe1" src="HTMLPage1.htm"></iframe>
- On the File menu, click Save
HTMLPage1.htm.
- Right-click in the HTML view of the
HTMLPage1.htm page, and then click View Design.
You
may notice that the http://www.ValidURL.com Web page is
displayed in the iframe object, instead of a blank page.
When You Delete and Then Create an HTML Page
- Follow steps 1 to 9 of the "When You Modify the Value of
the src Attribute in an HTML Page" section of this article to create an ASP.NET
Web Application project that has an HTML page that contains an iframe element.
- In Solution Explorer, right-click
HTMLPage1.htm, and then click
Delete.
- Right-click Iframetest, point to
Add, and then click Add HTML Page.
- In the Add New Item - Iframetest dialog
box, click Open. By default, the
HTMLPage1.htm page is created.
- Right-click in the Design view of the HTMLPage1.htm page,
and then click View HTML Source.
- Replace the existing code with the following code to add
an iframe element to the HTMLPage1.htm page:
<html>
<head>
<title>HTMLPage1</title>
</head>
<body MS_POSITIONING="GridLayout">
<iframe id="iframe1" src="HTMLPage1.htm"></iframe>
</body>
</html>
- On the File menu, click Save
HTMLPage1.htm.
- Right-click in the HTML view of the HTMLPage1.htm page, and
then click View Design.
You may notice that the
http://www.msn.com Web page is displayed in the iframe object, instead of a blank page.
For more information about
iframe, visit the following Microsoft Developer Network (MSDN) Web site:
APPLIES TO
- Microsoft Visual C# .NET 2003 Standard Edition
- Microsoft ASP.NET 1.1
| kbwebbrowser kbcontrol kbcaching kbhtml kbprb KB830737 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate