I have a puzzling problem. I am using some code I found in another
thread here to output the results of a gridview to excel. Here is the
subroutine:
Sub SendToExcel(ByV al Source As Object, ByVal E As EventArgs)
Dim gv As GridView = Ctype(ColRep1Fo rm.FindControl( "xlsRep1GridVie w"),
GridView)
If gv.Rows.Count.T oString + 1 < 65536 Then
gv.AllowPaging = False
gv.AllowSorting = False
Dim tw As New System.IO.Strin gWriter()
Dim hw As New System.Web.UI.H tmlTextWriter(t w)
Response.Clear( )
Response.Conten tType = "applicatio n/vnd.ms-excel"
Response.AddHea der("content-disposition",
"attachment;fil ename=dept1.xls ")
Response.Charse t = ""
EnableViewState = False
gv.visible= true
gv.RenderContro l(hw)
Response.Write( tw.ToString())
Response.End()
gv.DataBind()
End If
End Sub
I have a test server and a production server. Both are running Windows
2003 Server (IIS 6). The aspx code is identical on each.
On the test server, this code works, if I use firefox, or if I use IE6
and save the file. On the production server, the code works with
Firefox, but not at all with IE (6 nor 7). In all cases, when I click
the button which invokes this subroutine, I get the dialogue asking me
if I want to open excel or save to a file.
On either server, if I try to open the file from IE, I get an error
message in Excel to the effect that the file in the temp folder
(C:\documents and settings\userna me\local settings\tempor ary internet
files\content.i e5\famdomfolder name\dept1.xls) cannot be found. This
sounds a little like a permissions issue, as if IE tried and failed to
save the output stream to a file first before invoking excel to open
it.
If I'm browsing to the test server using IE, I can save the output to a
file and then open it. On the production server, even if I choose
save, I get an error message which reads "Internet Explorer cannot
download deptrep1.aspx from (the name of my site). Internet Explorer
was not able to open this internet site. The requested site is either
unavailable or cannot be found. Please try again later." Deptrep1.aspx
is indeed the name of the aspx page, but I am puzzled because I am not
trying (or at least I think I am not trying) to download it.
The only difference I can see between these servers is that the test
server is using http but the production server requires https. I don't
know if that is significant or not.
Does anyone have any suggestion how to troubleshoot this problem, or
how to make the code more robust to try to avoid any potential
problems? (I have omitted the Else clause in the code because there is
really no chance that the output will exceed 64K rows.) What would be
cool is if the user could either save or open the file, no matter which
browser they use. Barring that, it would be great if I could prevent
the user from having to choose whether to save or open (by making the
correct choice for the user). What is essential is to have something
that works, on the production server, using either firefox or IE.
Thanks.
-- Ned 0 1392 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ange T |
last post by:
Hi there,
I'm having pain with the VB behind an Access form. The form is used to
create reports in Excel based on the details entered in the form. This
has always worked without error on my machine (NT4, Access 2k),
however as soon as I attempt to create anything on another machine
(NT4, Access 2k) which most users will be working from, I receive an
automation error.
The problem line with the code is:
|
by: Rob G |
last post by:
Hi,
I am new to this ASP.NET thing and while going very slow, I am learning.
Then I got a Configuration Error out of nowhere when I ran my project.
I do have Excel as reference (but I haven't been able to use it yet).
My project has been running just fine and I am sure I did something strange
to make this occur, but I have no idea what I did. So now, all the work I've
put into this, is gone. Well, I hope not.
|
by: Rich Wallace |
last post by:
Hi all,
I have a VB app that runs and manages individual XLS files within a single
COM object. Upon processing the final fie, I attempt to close out the EXCEL
object and release it using
System.Runtime.InteropServices.Marshal.ReleaseComObject.
I have a Try...Catch in my routine as seen below and when I receive the
error, my Catch is never called so my app sees the release as successful,
but when I look in Task Manager, the EXCEL.EXE...
|
by: zfraile |
last post by:
I'm getting this error from the JIT compiler at runtime, but only on my boss'
machine, not my development machine. I believe the error is generated from a
call to an Excel object, but I can't tell why or what specific action on the
object is causing it.
We both are running version 2.0 of the .net framework with Office 2003
installed, though I am running XP and she has Win2000. Also, I do not get
this error when running another sub in...
|
by: Peter Nimmo |
last post by:
Hi,
I am writting a windows application that I want to be able to act as if
it where a Console application in certain circumstances, such as error
logging.
Whilst I have nearly got it, it doesn't seem to write to the screen in
the way I would expect.
The output is:
| |
by: Pritesh3 |
last post by:
Hi,
i created this small asp script which basically scans files9web pages) for word(s) if found, it takes the line and outputs the line into an excel sheet. The excel sheet is generated using html.
The problem I have is that I noticed if a word is found in the title tag e.g. <title>word</title>
The script will take the entiore line and write it to the excel file. The problem is that once you open the excel file. The field which...
|
by: shara |
last post by:
Hello,
I have a php script that outputs an excel sheet.The user has to download macro every time he wants to run the macro on the excel sheet.
Is there anything in php where the code downloads macro also along with the excel sheet or something like a button in excel sheet itself, clicking on which the macro runs on the excel sheet.
Any help is well appreciated.
Thanks&Regards,
Shara.
|
by: almurph |
last post by:
Hi everyone,
I'm trying to output some numbers to an Excel file. the first number
in A1 the second in A2, you know like this:
1
2
3
4
|
by: JRough |
last post by:
I'm trying to use output buffering to cheat so i can print to excel
which is called later than this header().
header("Content-type: application/xmsdownload");
header("Content-Disposition: attachment;
header("Pragma: no-cache");
header("Expires; 0");
print "$header\n$data";
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |