1

I am working on a feature where our site is able to load another mvc site. Basically I am using a Iframe with Id=aquaVetIframe where I put the url for my mvc site(setup of the src attribute for the iframe is done from codebehind). Everything is working fine in chrome. but at moment to test it using IE 10 the only thing what i can see in IE is the login page. After sign in with the user the page return to the same login page. I could suppose that is related with the caching but i am not 100% sure.

here some code: My aspx container:

<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
<meta http-equiv="Cache-Control" content="max-age=0" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<style type="text/css"> 
    html, body{height: 100%;}
</style>
</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="MainContent" runat="server">
  <div style="height: 100%; width: 100%;">
      <iframe id="aquaVetIframe" runat="server" allowfullscreen="true"  style="position: absolute;height: 100%; width: 100%;border:0px"> </iframe>  
    </div>
</asp:Content>

Code behind:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    Dim urlQueryString = Request.QueryString("urlId")

    aquaVetIframe.Attributes("src") = urlQueryString

End Sub

At the top of my page I tried add the next tags, but with no luck:

<meta http-equiv="Cache-Control" content="max-age=0" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />

Here an image of the http post requests using IE10 and chrome (browser where currently is working my app) http://postimg.org/image/iaifcljdz/ enter image description here UPDATE: Adding this line to my mvc application, cookies are allowed from IE and the application run fine while I executing the page directly in the browser (right click on run on IE browser in VS2013)

context.BeginRequest += (sender, args) => HttpContext.Current.Response.AddHeader("p3p", "CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");

The issue what i have now is that my mvc aplication is not executing when I run my application from the begining.. for some strange reason the js libraries from mvc app are not loading.. see screenshot error comming from mvc app

Pranav Singh
  • 17,079
  • 30
  • 77
  • 104
Rolando
  • 752
  • 1
  • 14
  • 41

3 Answers3

1

Go to IE > interntet options > security > custom level > Scroll down Misc > find "Launching programs and files in an Iframe" > enable

Hillboy
  • 472
  • 6
  • 19
1

Three things at a first look:

1) the iframe loads a full html page. So I recommend you to import the jquery libs inside the page you loaded inside the iframe (the login page);

2) IE is a good source of problem when testing a localhost server. It sometimes force a compatibility to IE8 or even IE7 on intranet (that includes localhost) pages. Ensure you have the IE10+ mode enabled. This question shows you how to do it:

You can achieve it by adding the following tag to your page

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
</head>

OR you can also add the following code in your web.config, inside the system.webserver tag (create it if it doesn't exist):

<system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="X-UA-Compatible" value="IE=Edge" />
      </customHeaders>
    </httpProtocol>
</system.webServer>

3) As you didn't show your tags including the JS files, then It's a good idea to take a look at them (including the jquery ones). Ensure:

  • You are opening and closing <script></script> tags correctly. NEVER USE THE SHORT FORM <script /> when including a JS file because it won't work;
  • Make sure you are using the correct path. Using a relative path (like ~/scripts/jquery.js) doesn't work because of '~'. You can also find some trouble if you are using a subfolder for your site's root, like http://localhost/mysite/. In this case, your includes should include the folder /mysite or use relative paths (like scripts/jquery.js, ../scritps/jquery.js, etc).

Maybe this is isn't enought, but is a first needed step to get closer to a working code.

Community
  • 1
  • 1
Rafael Brasil
  • 232
  • 1
  • 6
  • Hi, I can see that my problem is with the point number 2 and I tried follow the link what you have showed but the solutions are not working for me :).. I will continue working with this and i will update my question – Rolando Sep 01 '14 at 03:23
  • 1
    The problem was in one of the parent pages of the container app.... ... the bad thing is that I can't change it.. – Rolando Sep 02 '14 at 15:26
0

Consecutive ajax call with no change in request are often considered as cached by some browsers and this issue is particularly reproducible in IE 10. The response for request is HTTP 304 Not Modified and request doesn't hit the database. The solution is to use ajaxSetup to set cache to false like :

$(document).ready(function() {
  $.ajaxSetup({ cache: false });
});

NOTE: This will set cache false for all ajax calls in the session.

OR

Using cache: false in particular ajax calls, if you don't want to disable cache for all ajax calls.

$.ajax({
         ...
         cache: false,
         ...
      });

For non-ajax call you can use :

Response.Cache.SetExpires(DateTime.Now.AddSeconds(0));

to response for suspected cached calls.

Also, it may be seems odd but I also faced similar issue in IE but that was due to cookie. Somehow there were two different cookies are created with same name & thus values stored in cookie wasn't found thus user was stuck on login page. Check if COOKIE is also not culprit in your case too.

Pranav Singh
  • 17,079
  • 30
  • 77
  • 104