Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

PRB: iframe Object Source Is Cached in the Design View of an HTML Page in Visual C# .NET


View products that this article applies to.

Symptoms

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


Workaround

To work around this problem, refresh the HTML page in the Design view.

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


More information

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

  1. Start Visual Studio .NET.
  2. Use Microsoft Visual C# .NET to create an ASP.NET Web Application project that is named Iframetest.
  3. In Solution Explorer, right-click Iframetest, point to Add, and then click Add HTML Page.
  4. In the Add New Item - Iframetest dialog box, click Open. By default, the HTMLPage1.htm page is created.
  5. Right-click in the Design view of the HTMLPage1.htm page, and then click View HTML Source.
  6. 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>
    
  7. On the File menu, click Save HTMLPage1.htm.
  8. 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.
  9. 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>
    
  10. On the File menu, click Save HTMLPage1.htm.
  11. 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

  1. 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.
  2. In Solution Explorer, right-click HTMLPage1.htm, and then click Delete.
  3. Right-click Iframetest, point to Add, and then click Add HTML Page.
  4. In the Add New Item - Iframetest dialog box, click Open. By default, the HTMLPage1.htm page is created.
  5. Right-click in the Design view of the HTMLPage1.htm page, and then click View HTML Source.
  6. 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>
  7. On the File menu, click Save HTMLPage1.htm.
  8. 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


References

For more information about iframe, visit the following Microsoft Developer Network (MSDN) Web site:

↑ Back to the top


Keywords: KB830737, kbprb, kbhtml, kbcaching, kbcontrol, kbwebbrowser

↑ Back to the top

Article Info
Article ID : 830737
Revision : 6
Created on : 5/17/2007
Published on : 5/17/2007
Exists online : False
Views : 371