M
Moe Sisko
Using : ASP.NET 2.0, IE 7.
This is a strange problem with popups not working in IE to remote sites,
even though popups are allowed in IE.
To reproduce, create web site with two pages, Default.aspx and
Default2.aspx. Note that the example is a deliberately simplified example -
just used to reproduce the problem, and not meant to be very useful.
Default.aspx - add button1. In codebehind, hookup click event :
==
protected void Button1_Click(object sender, EventArgs e)
{
string scriptText = "window.open('Default2.aspx','', '');";
ClientScript.RegisterStartupScript(GetType(), "MyKey", scriptText,
true);
}
==
In Default2.aspx codebehind, add :
==
protected void Page_Load(object sender, EventArgs e)
{
Response.Clear();
Response.ContentType = "text/plain";
Response.AddHeader("Content-Disposition", "attachment; filename=" +
"Report.txt");
Response.Write("hello world");
Response.Flush();
Response.End();
}
==
Browse to Default.aspx, then click button1. The intended behaviour is for a
dialog box to come up, with something like : "Do you want to open or save
this file ?". Then the user can view or save this file. This all works fine
when the browser and web site are all on the same PC. Popups are enabled in
IE. (Note that I'm using IIS to the run the pages from outside the Visual
Studio IDE).
However, when browsing to a remote site hosting these pages over the
internet, even though popups are allowed for this site in IE, the dialog box
never comes up, and the user never gets a chance to see the file. If I hold
down the CTRL key (to disable popups for the request), then press button 1,
then things work. But I don't understand why the CTRL key needs to be
pressed in IE when popups are disabled.
Using Firefox 2, things work ok.
Has anyone seen this ? Any ideas ?
TIA,
Moe
This is a strange problem with popups not working in IE to remote sites,
even though popups are allowed in IE.
To reproduce, create web site with two pages, Default.aspx and
Default2.aspx. Note that the example is a deliberately simplified example -
just used to reproduce the problem, and not meant to be very useful.
Default.aspx - add button1. In codebehind, hookup click event :
==
protected void Button1_Click(object sender, EventArgs e)
{
string scriptText = "window.open('Default2.aspx','', '');";
ClientScript.RegisterStartupScript(GetType(), "MyKey", scriptText,
true);
}
==
In Default2.aspx codebehind, add :
==
protected void Page_Load(object sender, EventArgs e)
{
Response.Clear();
Response.ContentType = "text/plain";
Response.AddHeader("Content-Disposition", "attachment; filename=" +
"Report.txt");
Response.Write("hello world");
Response.Flush();
Response.End();
}
==
Browse to Default.aspx, then click button1. The intended behaviour is for a
dialog box to come up, with something like : "Do you want to open or save
this file ?". Then the user can view or save this file. This all works fine
when the browser and web site are all on the same PC. Popups are enabled in
IE. (Note that I'm using IIS to the run the pages from outside the Visual
Studio IDE).
However, when browsing to a remote site hosting these pages over the
internet, even though popups are allowed for this site in IE, the dialog box
never comes up, and the user never gets a chance to see the file. If I hold
down the CTRL key (to disable popups for the request), then press button 1,
then things work. But I don't understand why the CTRL key needs to be
pressed in IE when popups are disabled.
Using Firefox 2, things work ok.
Has anyone seen this ? Any ideas ?
TIA,
Moe