ASP.Net Exporting dataset/repeater/html to excel

I have an application that exports any of the above types to excel using    
response.ContentType = "application/vnd.ms-excel"

Recently the app stopped working, the excel report page flashes on the screen and then disappears.  Is anyone else running into this with IE or IIS upgrades?  These were originally built on Win2000Server recently migrated to Win2003Server.
Nobletucky2004Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AgentSmith007Commented:
I've recently experienced a similar issue, however I couldn't attribute it to the web server. I found an inconsistency with WinXP SP2 browsers having this issue. I forgot exactly what I was doing, but it was something like redirecting to a different file and then firing a window.close() from javascript. It worked all the time before and then stopped working on XP SP2 machines. I had to add some workaround javascript. I don't know if this is what's happening to you, just sharing my 2 cents. Can you post some more of your sample code?
0
Nobletucky2004Author Commented:
   response.Clear();
    response.Charset = "";
    //set the response mime type for excel
    response.ContentType = "application/vnd.ms-excel";
    //create a string writer
    System.IO.StringWriter stringWrite  = new System.IO.StringWriter();
    //create an htmltextwriter which uses the stringwriter
    System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
    //instantiate a datagrid
    DataGrid dg = new DataGrid();
    //set the datagrid datasource to the dataset passed in
    dg.DataSource = ds.Tables[0];
    //bind the datagrid
    dg.DataBind();
    //tell the datagrid to render itself to our htmltextwriter
    dg.RenderControl(htmlWrite);
    //all that//s left is to output the html
    response.Write(stringWrite.ToString());
    response.End();
0
Nobletucky2004Author Commented:
what type of JavaScript workaround did you use to alleviate this problem?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

AgentSmith007Commented:
The case I had is that I was popping up a window from the existing window (after some browser detection was done) and i was initially doing this:

window.open(...);
top.close();

When this stopped working I had to do this:

window.open(...);

function fClose(){
   top.close();
}

then from the window that popped up I did a:

window.opener.fClose();

This doesn't seem to be your issue though. I'm gonna refer this question to a friend of mine that's more .net savvy
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Nobletucky2004Author Commented:
Could this have something to do with a setting that is dealing with Trusted Sites.  It seems that when the URL is added to Trusted Sites the files will open in excel, but that presents an issue with having to figure out if users have the URL set in trusted sites, that is rather messy.
0
AgentSmith007Commented:
Interesting. Is you IE security set beyond default? Try going into Tools -> Internet Options -> Security and setting the internet zone to the default setting and see what happens.
0
Nobletucky2004Author Commented:
yea, most users that are testing this now have default security settings post an SP2 update.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.