0

I'm currently in the process of making sure an older MVC4 site that was built and primarily ran using IE11 works for other browsers. The first we're testing against is Edge Chromium, but we encountered an issue where a popup happens.

When the popup occurs, we pass a query string like so:

http://localhost/Gen/DataExport?cntId=100&InitialLoad=True&showProgress=False&startExport=False

where

  • cntId is our record identifier
  • InitialLoad is a true/false value letting the system know this is the first time the user is in the page (it does some operations that requires the page refreshing)
  • showProgress is a true/false value letting the system know to show the progress of certain operations (we don't show when first loading the page)
  • startExport is a true/false value telling the system when to export certain data (not used initially)

Back in the Controller code, we have an HttpGet method for loading the page. The method receives cntId, InitialLoad, showProgress, and startExport.

Everything works as expected when using IE11. The passed in parameters arrive and are read correctly.

However, the issue we have found is when Edge Chromium, Chrome, and Firefox try to load the page, the query string arrives with incorrect data.

Each of the browsers show that cntId is 100, but InitialLoad is false for some reason.

I'm at a loss why this one page does not pass parameters correctly, while all the others do. It could be due that the system is opening a new window possibly, but I'm unsure.

EDIT:

I'm going to be more explicit here since a few people can't read my question, along with the tags for this question.

This is an MVC4 application, using C# on the backend and hooked to an Oracle DB. It is a project that is used by a government entity, who still uses IE11.

IE11's support runs out in August. Obviously, said government entity needs to still use this MVC4 application. Hence why I'm trying to make sure it works in Edge (Chromium version), Chrome, Firefox, and Safari.

Now that the nonsense is out of the way, on to examples of my code. I have a View with a link on it. The link calls a Javascript function that proceeds to open a popup window. The code is the following:

function OpenGen() {
    var url = '@Url.Action("DataExport", "Gen", new { cntId = @Session["cntId"], InitialLoad = true, showProgress = false, startExport = false })';
    //Open the new window for the Gen
    window.open(url, "GenWindow", 'height=' + screen.height + ',width=' + screen.width + ',resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=yes');
}

After the link is clicked, the server executes the following code in the GenController:

[HttpGet]
public ActionResult DataExport([Optional, DefaultParameterValue(-1)]int cntId,
        [Optional, DefaultParameterValue(false)]bool InitialLoad,
        [Optional, DefaultParameterValue(false)]bool showProgress,
        [Optional, DefaultParameterValue(false)]bool startExport)
{
    if (InitialLoad)
    {
        ...
    }
}

I am debugging on the if statement for InitialLoad. The parameters passed in when using IE11 are correct.

cntId = 100, InitialLoad = true, showProgress = false, startExport = false

However, when debugging for Edge, Chrome, Firefox, and Safari, I get the following parameters:

cntId = 100, InitialLoad = false, showProgress = false, startExport = false

I'm unsure why Edge, Chrome, Firefox, and Safari are losing the parameters. The url for the four is the same as IE11's.

Now, with that said, any thoughts on this issue would be welcomed.

IyaTaisho
  • 863
  • 19
  • 42
  • 1
    You may want to take a look at the dev console to see if there are any errors, and add your `HttpGet` signature, front-end code, etc. to the question. – Kit May 05 '21 at 19:41
  • What if you paste the URL into a new IE11 window directly without the popup? That would at least eliminate the variable of popup. – wrschneider May 05 '21 at 19:42
  • 1
    At a guess, it's probably working in IE11 and nowhere else because the frontend was coded to an IE11 quirk or old JavaScript of some kind. – Kit May 05 '21 at 19:43
  • What does `but InitialLoad is false for some reason.` mean? Where is it `false`? In the received request? In the action parameters? What's the type of the action parameter? Parameter binding is *not* affected by the browser. URLs are case sensitive though, and the string `true` isn't the same as the string `True`. – Panagiotis Kanavos May 05 '21 at 19:43
  • What does the server code do? How are the query parameters handled? You're asking for debugging help with no code at all. `It worked with IE11` doesn't mean much. I – Panagiotis Kanavos May 05 '21 at 19:45
  • I agree with the comments above. You need to try to debug line by line and provide more debugging details. You can use F12 dev tools to debug the code in IE and other browsers. Besides, we need [a minimal code snippet](https://stackoverflow.com/help/minimal-reproducible-example) which can **reproduce the issue**. We can't find the issue with no code. – Yu Zhou May 06 '21 at 02:53
  • @PanagiotisKanavos Uh... Government does... Also, not a fair assessment to assume IE11 is unused. It still has support until August, so yeah, bad assumptions there. – IyaTaisho May 06 '21 at 14:37
  • @Kit I did run the code through the console (Visual Studio 2019). While debugging it, I found that with IE11, the parameters passed in are correct. While debugging using Edge, Firefox, and Chrome, the parameters are not passed in correctly. I do have the HttpGet signature. I'll add some code, but the code is pretty basic. – IyaTaisho May 06 '21 at 14:40
  • 1
    From this thread, it's clearly browser behavior alone, and how said browsers are dealing with frontend HTML, Javascript, etc. Seems like you're going to have to research browser behavior against the context of said code. – Kit May 06 '21 at 14:47
  • @Kit Yes, it does seem to be browser behavior to some regard. My suspicion is it has something to do with the fact the site is using a popup. Everywhere else in the system, I have removed popups but this one piece. I left it alone because it's a very essential piece as is that can't be changed for the time being. – IyaTaisho May 06 '21 at 15:23

1 Answers1

0

I figured out the issue. For some odd reason, Edge, Chrome, Firefox, and Safari were not dealing with the '&' properly. I know that ampersand is a value that gets encoded but it's weird that each browser couldn't decode it on their own. When I dumbed it down for them, it worked.

IE11 was the only one dealing with it for some odd reason.

Regardless, it's just a weirdness with the parameters not getting dealt with specifically when opening a popup.

IyaTaisho
  • 863
  • 19
  • 42
  • Thanks for posting the solution for this issue. You can mark your answer as an accepted answer. It can help other community members in future in similar kind of issues. Thanks for your understanding. – Yu Zhou May 10 '21 at 01:25
  • Yes, I had planned to. I was off over the weekend is why I hadn't. – IyaTaisho May 10 '21 at 14:30