I have a problem with IFrame

hai ,

I have an iFrame for display dynamic pages in my page.

 <iframe id="divIFrame" scrolling="no" runat ="server"  src="Login.aspx"  frameborder="0"
       style="width: 575px; height:323px; padding:0px;z-index:0px;" >
 </iframe>

In the code behind I used one line code to add ‘src’ attribute to the iframe.

 divIFrame.Attributes("src") = "..PagesCompany.aspx"

it’s works in IE aand crome but Not in Mozila firefox.It shows an Error Like this

Server Error in '/' Application.
HTTP Error 400 - Bad Request.
Version Information: ASP.NET Development Server 9.0.0.0

Please help.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You need to use forward slash / and not backslash in your URL.

 divIFrame.Attributes("src") = "../Pages/Company.aspx"

Internet Explorer is quietly converting the slashes for you, masking a problem. Firefox correctly doesn’t.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x