Link to home
Start Free TrialLog in
Avatar of inewman
inewman

asked on

Error in IFrame using IE7. Works ok in Firefox

I have a very simple web page that has an external url in an Iframe.  While running the external web page a request is made to enter an email address and Password.    When the viewer enters the password and click Log-in the page fails when using IE7.  The page works OK with Firefox. Attached is the error.

Following the error is my code.
Object reference not set to an instance of an object. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
 
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
 
Source Error: 
 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
 
Stack Trace: 
 
 
[NullReferenceException: Object reference not set to an instance of an object.]
   BWWIBOWebspaceFormBase.showDream() +41
   IBO_Webspace_dream.Page_Load(Object sender, EventArgs e) +10
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   BWWFormBase.OnLoad(EventArgs e) +310
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
HTML CODE
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
</head>
<body>
<center><table>
<tr>
<td >At the login screen enter your email address. The Password is Freedom.
</td>
</tr>
 
 
</table></center>
<iframe src="http://www.newmanintl.com/business-options.aspx" width="100%" height="1000 px"  />
</body>
</html>

Open in new window

Avatar of James Rodgers
James Rodgers
Flag of Canada image

you should not do this
<script type="text/javascript">
                function submitForm(){  
                  document.getElementById('aspnetForm').action = document.getElementById('aspnetForm').action.Replace("IBO_Webspace/", "");
                  document.getElementById('aspnetForm').submit();
              }
            </script>


also js is case sensitive, Replace should be replace
Avatar of inewman
inewman

ASKER

Jester_48
I'm sorry but I don;t understand what you are saying.  You say Ishould not do this.  I don't see where I used any java script.  Do I use this script instead of the iframes? Sorry I don't get it.

Ira
Please provide more details.  The html source for at least the main page and the form would help.  It isn't clear where the form is (main page or iframe).  Also what do you "running the external web page"?

The error you posted doesn't really make sense without more info.  There is no way that came just from html or javascript.  It looks more like an applet or object in the page but we have no info on that.

bol
the above script is part of teh form page and if you are pulling teh form page in form another location and embedding it in your page to submit to another location then you will have problems
Avatar of inewman

ASKER

The entire code for the web page is displayed in the question below the failure information.  When I open the page the external link

http://www.newmanintl.com

opens on the page. A short video is played.  When the video is over a screen opens asking for an email address and password (which I have supplied to the viewer.) in order to get additional information.

When the viewer enters the information another video should start playing.  This happens OK when Firefox is used but when IE is used the page fails.  The failure is also documented above.  

I hope this is clear enough.  Thanks for your patience.

Ira
Avatar of inewman

ASKER

I am sorry. I forgot to supply the url for the original web page.  It is

http://www.newmanmarketing.com/thanks.html

Hope this helps.

Ira
That "code" is just the html source for the error page.  Not really that helpful on its own.  The URL did help so thanks.  A quick question about the page that does show the error.  It is named dream.aspx on the remote server.  What does that page have to do with the login.aspx page on that server?  Can this work if you not use the iframe and try to run this from your server?

Your problem is almost certainly related to running this in the iframe and from a remote server.  It could be related to 3rd party cookies, which .NET will use at the very least for session management but be treated as 3rd party because of your page design (the iframe and remote server).  IE7 is more restrictive on 3rd party cookies than prior version and your Firefox may allow  them (I believe it does by default).  Cookies is just a theory though and the server itself could have code that causes this.

First test to see if this works without the remote server stuff.  If so then start by looking into dream.aspx, the page that gives the error.

There is one problem in your Javascript on the page with the login.  At the very least a typo but the syntax may be bad too.  I have made changes to the function and it is in the snippet below.  If we are really lucky that may be the only problem but with your remote server I won't hold my breath. :)

Let me know how this works or if you have a question.

bol
<SCRIPT type=text/javascript>
		    function submitForm(){   
                    var sAction = document.getElementById('aspnetForm').action;
	            document.getElementById('aspnetForm').action = sAction.replace("IBO_Webspace/", "");
	            document.getElementById('aspnetForm').submit();
	        }
            </SCRIPT>

Open in new window

Avatar of inewman

ASKER

If you look below the error code on my code snippit you will see the very simple 15 lines of code that create the web page that is presented when the url

http://www.newmanmarketing.com/thanks.html

is entered.  The error code comes first, then the web page.

I have no access to the www.newmanintl.com website that is framed and cannot make any changes to that code.  

When I  open www.newmanintl.com from any browser, it works OK.

If it is a cookie issue with IE, is there any way of dealing with it in the code?



Ira
>> If you look below the error code on my code snippit you will see the very simple 15 lines of code that create the web page that is presented when the url  <<

I have seen that from the start but that info is honestly useless for working on this.

>> I have no access to the www.newmanintl.com website that is framed and cannot make any changes to that code. <<

Then we won't really be able to help with this.  What you are trying to do (run a site inside yours) is very commonly prevented by server script and even browser security.  Even if you did control the code on the remote server we could have problems getting this to work.  Without control or access to it then we really have no recourse if there is a problem like this.

>> If it is a cookie issue with IE, is there any way of dealing with it in the code? <<

Not in your code or as a web developer.  A user could allow 3rd party cookies.  There are various 3rd party security programs that will do this and you may have installed on your computer (e.g. Zone Alarm).  In IE the setting is related to the "zone" the site is in so a user could add the remote server's domain to their trusted list.  The general setting is usually found under the Privacy tab in Internet Options (Tools -> Internet Options).  All of these are user adjustable though so there is no way to affect this as a web developer.

Let me know how this helps.  If you have a legitimate relationship with the remote server "company" then try to get info from them to allow you to resolve this.  If this is the way they want you to work with their site then they will want to see this work for you.  If you have no relationship at all and want to help your users use the other site then open a new window for their site and eliminate the iframe.  That is a practice for sites that try to mislead visitors (embedding a site, especially when you show little of your page) so it will usually have issues and concerns from users, even if your intentions are good.

I hope this helps.  Let me know if you have a question or need more info.

bol
By the way ... thanks for the response about it working when the remote site is in its own window.  That does confirm the issue is one of those I mentioned.

bol
Avatar of inewman

ASKER

Why does everything work ok in Firefox and fail in IE?  Is it the way the browser handles security.  Is IE more secure than Firefox 3.  Or is IE just using overkill.

It seems I won't be able to run the video in the frame.  Thanks for your help.

Ira
ASKER CERTIFIED SOLUTION
Avatar of b0lsc0tt
b0lsc0tt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of inewman

ASKER

b0lsc0tt

I guess "you can't" is an answer to my question and no one has offered any other answers.  I'll close this question and award you the points.

I just posted a question on html email.  Maybe you can help on that.

Thanks.

Ira
Ira,
Your welcome!  Yes, "you can't" can be an answer. :)  Thanks for the grade, the points and the fun question.  I'm glad I could help.
bol