Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

File Download Hangs

Posted on 2006-07-10
16
Medium Priority
?
312 Views
Last Modified: 2008-02-01
A very strange problem.  The following code works everywhere except on client pc’s.

public void excelConvert(DataSet ds, HttpResponse response, string reportName)
{
      System.IO.StringWriter  stringWrite = new System.IO.StringWriter();
      System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);

      DataGrid dg = new DataGrid();
      dg.DataSource = ds.Tables[0];
      dg.DataBind();
      dg.HeaderStyle.Font.Bold = true;
      dg.RenderControl(htmlWrite);

      response.Clear();
      response.Charset = "";
      response.ContentType = "application/vnd.ms-excel";
      response.AddHeader("Content-Disposition", "attachment;filename="+reportName+".xls");
      response.Write(stringWrite);
      response.Flush();
      response.End();
}

In our development environment (and most everywhere else) this code will cause  the Open/Save/Cancel dialog to display. When you  select Open, Excel is launched and the spreadsheet displayed.  Selecting Save works as you would expect.  In the production environment, Open/Save/Cancel dialog displays,  you select Open and it hangs on  File Download. And will stay there forever.  Selecting save acts the same, hangs on File Download.  The odd thing is that if you look in the Internet Temp Files directory on the failing client you will see that the .xls file requested is there, but Excel is never launched.  I’ve been on the phone with Microsoft Support for 2 days and nothing. They were able to run my code fragment there with no problems.  I have this code running on a number of tester systems and it runs fine.  Simple question (hard answer) why does this rather straight forward piece of code not work on the clients PC?  

One other hints: If I boot the failing client in Safe Mode it works fine.  

It seems like some permissions/policy issue but I can’t  figure it out.

Any ideas would be appreciated.
0
Comment
Question by:slm_tycoon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 4
  • 2
  • +1
16 Comments
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 17078769
have you tried different browsers? try using firefox on a failing client PC and see if you get the expected results or another failure
0
 

Author Comment

by:slm_tycoon
ID: 17078782
sammy1971

my client only uses IE
0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 17078792
another thing that would cause this is having an active antivirus attempting to scan the .xls file as its being opened or downloaded.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:slm_tycoon
ID: 17078832
sammy1971

nope, turned off virus scan

tried all the usual stuff.  you see, the file is in the temp directory and i can open it and it looks fine.

what would stop the launch of the target application?

nothing on the group policies, either N/A or none

one other thing,  
response.AddHeader("Content-Disposition", "inline;filename="+reportName+".xls");
works

0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 17078857
that is really strange
0
 

Author Comment

by:slm_tycoon
ID: 17078869
you got that right!

i've had IIS, ASP.NET, and IE guys/gals from MS on the phone for 2 days and all they can come up with is it a 3rd party application/service that is causeing the problem.  THANKS. now what?

0
 

Author Comment

by:slm_tycoon
ID: 17078874
i have to agree with one thing, that it feels like some kind of "permissions" thing. i just can't identify what it is.
0
 
LVL 27

Accepted Solution

by:
Sammy Ageil earned 1000 total points
ID: 17078876
One thing I would try is disable all add on in IE
try that if you havent already
0
 

Author Comment

by:slm_tycoon
ID: 17078887
sammy1971

tried that.
0
 
LVL 14

Assisted Solution

by:Ramuncikas
Ramuncikas earned 1000 total points
ID: 17079449
Try setting ContentType to "application/download" or "application/unknown".
0
 

Author Comment

by:slm_tycoon
ID: 17080863
Ramuncikas

nope



0
 
LVL 14

Expert Comment

by:Ramuncikas
ID: 17081191
Well, I think it is a situation where problem comes NOT from your code, but from client workstation. I guess you know that when you install software remove it then install another one then remove again and so on then computer becomes king of buggy. Another factor is viruses, ad-ware, spyware, amount of them and the way they were removed. As a result of this is "dirty" windows registry whitch infact very often has impact like this in situations like this. At these situations I don't bother myself with questions how to fix this or that but I just do a clean reinstall of my computer. Yes, it's time consuming but I think it's worth it.
I don't know for sure but I think that your page hangs on 10% of computers you tested at most. So I suppose these are computers that fall under the problems whitch I described here (and not only these).
My suggestions would be:
#1. Try to google with keywords like "IE hang download open save"
#2. In windows explorer go to Menu Tools/Folder options, open File Types tab, find a XLS extention, select it and hit the Advanced button. There is a checkbox "Confirm open after download". I don't know what impact it has but worth to play with it.
#3. Try using utility like TuneUp Utilities. I've used it several times with luck. Very helpful to clean registry from missing/invalid references in registry. Of course if you are not the owner of a "fault" computer then you should get owner's permition to do that.

Again I'm 90% sure that it's not about your code
0
 

Author Comment

by:slm_tycoon
ID: 17111234
Thanks to all for the ideas but nothing helped.
0
 

Author Comment

by:slm_tycoon
ID: 17138480
Solved the problem!

Seems that a single signon product was "pushed" to some client PCs and, for some reason, it stopped the launch of the streamed file.  When it was uninstalled, all was right again.  Still need to look into why that happens but at least now I know what was causing the problem.

0
 

Author Comment

by:slm_tycoon
ID: 17198404
You guys made the effort.
0
 

Expert Comment

by:RealtimeEngineeringLtd
ID: 22958225
Hi Slm_tycoon,

not sure if you're still following this thread ...

We are experiencing exactly the same problem with Single Sign On. Did you find a solution?
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question