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.
↑ Back to the top
To work around this problem, refresh the HTML page in the
Design view.
↑ Back to the top
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.
↑ Back to the top
For more information about
iframe, visit the following Microsoft Developer Network (MSDN) Web site:
↑ Back to the top