Microsoft KB Archive/830737

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

Article ID: 830737

Article Last Modified on 5/17/2007

-

APPLIES TO


 * Microsoft Visual C# .NET 2003 Standard Edition
 * Microsoft ASP.NET 1.1

-





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, where   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.



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



STATUS
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: HTMLPage1 <body MS_POSITIONING=&quot;GridLayout&quot;> <iframe id=&quot;iframe1&quot; src=&quot;http://www.ValidURL.com&quot;> </li> On the File menu, click Save HTMLPage1.htm.</li> Right-click in the HTML view of the HTMLPage1.htm page, and then click View Design. You may notice that the  Web page is displayed in the iframe object.</li>  Switch to HTML view, and then modify the value of the src attribute of the iframe element as follows: <iframe id=&quot;iframe1&quot; src=&quot;HTMLPage1.htm&quot;> </li> On the File menu, click Save HTMLPage1.htm.</li> Right-click in the HTML view of the HTMLPage1.htm page, and then click View Design.

You may notice that the  Web page is displayed in the iframe object, instead of a blank page.</li></ol>

When You Delete and Then Create an HTML Page
<ol> Follow steps 1 to 9 of the &quot;When You Modify the Value of the src Attribute in an HTML Page&quot; section of this article to create an ASP.NET Web Application project that has an HTML page that contains an iframe element.</li> In Solution Explorer, right-click HTMLPage1.htm, and then click Delete.</li> Right-click Iframetest, point to Add, and then click Add HTML Page.</li> In the Add New Item - Iframetest dialog box, click Open. By default, the HTMLPage1.htm page is created.</li> Right-click in the Design view of the HTMLPage1.htm page, and then click View HTML Source.</li>  Replace the existing code with the following code to add an iframe element to the HTMLPage1.htm page: HTMLPage1 <body MS_POSITIONING=&quot;GridLayout&quot;> <iframe id=&quot;iframe1&quot; src=&quot;HTMLPage1.htm&quot;> </li> On the File menu, click Save HTMLPage1.htm.</li> Right-click in the HTML view of the HTMLPage1.htm page, and then click View Design.

You may notice that the  Web page is displayed in the iframe object, instead of a blank page.</li></ol>

<div class="references_section">