If I add the code for user to download the file (e.g.
if(File.Exists( FILE_NAME)){... ...}), the ASP.NET will give the
following timeout error:
Timeout expired. The timeout period elapsed prior to completion of the
operation or the server is not responding.
It seems that the download file code is executing before letting the
previous code to finish. Even the message print code
(message.Text=" ...";) is not executed.
What could I do to eliminate this problem. These are the codes for my
ASP.NET application.
private void run_Click(objec t sender, System.EventArg s e)
{
message.Text="" ;
bool alert=false;
string connectionStrin g =
ConfigurationSe ttings.AppSetti ngs["connString "];
SqlConnection connection = new SqlConnection(c onnectionString );
if(option.Selec tedValue.ToStri ng()=="C")
{
SqlCommand command = new
SqlCommand("inl etter3_uterm",c onnection);
command.Connect ion=connection;
command.Command Type=CommandTyp e.StoredProcedu re;
command.Command Text = "inletter3_uter m";
.........
connection.Open ();
command.Execute NonQuery();
connection.Clos e();
string commandString ="select
rtrim(ref)+'/CEM/Rfd/'+rtrim(user_de pt_no)+'/'+substring(con vert(char,sel_d ate,112),3,4)
as ref_val,"+
"rtrim(convert( char,DATENAME(m onth, iss_date)))+'
'+rtrim(convert (char,day(iss_d ate)))+',
'+rtrim(convert (char,year(iss_ date))) as iss_date,"+
"rtrim(D.ti tle) as title from iv_letter3 L, iv_dept D where
L.user_dept_no = D.dept_no";
SqlDataAdapter dataAdapter = new SqlDataAdapter( commandString,
connectionStrin g);
DataSet ds = new DataSet();
dataAdapter.Fil l(ds);
DataTable dt = ds.Tables[0];
string FILE_NAME=@"c:\ inventry\doc\in let3ut.txt";
StreamWriter sw = new StreamWriter(FI LE_NAME, false,
System.Text.Enc oding.ASCII);
foreach (DataRow dataRow in dt.Rows)
{
sw.WriteLine("# "+dataRow["ref_val"].ToString().Tri m());
sw.WriteLine(da taRow["iss_date"].ToString().Tri m());
sw.WriteLine(da taRow["title"].ToString().Tri m());
}
sw.WriteLine("# ");
sw.Close();
if(updatedate.C hecked==true)
{
SqlCommand command2 = new
SqlCommand("inu tmti_upd",conne ction);
command2.Connec tion=connection ;
command2.Comman dType=CommandTy pe.StoredProced ure;
command2.Comman dText = "inutmti_up d";
............... ..
connection.Open ();
command2.Execut eNonQuery();
connection.Clos e();
}
message.Text="U ser Termination/Obsolete Letter successful
printed to a file\n";
//if such codes are commented, there is not timeout expired
error
if(File.Exists( FILE_NAME))
{
FileInfo myFileInfo = new FileInfo(FILE_N AME);
String filename = Path.GetFileNam e(FILE_NAME);
Response.Clear( );
Response.Conten tType = "applicatio n/octet-stream";
Response.AddHea der("Content-Disposition","a ttachment;
filename=\"" + filename + "\"");
Response.AddHea der("Content-Length",
myFileInfo.Leng th.ToString());
Response.Flush( );
Response.WriteF ile(FILE_NAME);
Response.End();
Response.Close( );
}
//end of codes giving timeout expired error
}
} 0 2037 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Vincento Harris |
last post by:
sql server 2000 8.00.194
Microsoft Windows 2000 Service Pack 2
I looked into my sqlserver agent log and found the following
ODBC Error 0 Timeout expired
logon to server local '( failed)' (Job manager)
I have no idea what that means but it did keep out users for a minute or more.
The threads found on this forum almost all point to reccuring situations
|
by: Silvia |
last post by:
I have a application web and when execute this for a long
time generated this error:
Server Error in '/RAIMServer' Application.
-----------------------------------------------------------
---------------------
Timeout expired. The timeout period elapsed prior to
obtaining a connection from the pool. This may have
occurred because all pooled connections were in use and
|
by: Jason |
last post by:
Hi all
I get the following error when executing a rather intense stored procedure
from an ASPX page.
I have tried:
- Increasing timeouts on IIS 5.0 (all areas that even mention timeout)
- use the "Connection Timeout=2400" string in the SqlConnection connections
string
- disabled connection pooling.
|
by: Chris Langston |
last post by:
I have a Web Server running IIS 5 or 6 on Windows 2K and Windows 2003 Server
that is experiencing strange shutdown problems. We are using ASP.NET v1.1
and our application is written in VB.NET
Here's the scenario:
1. .NET Windows Client on a remote machine makes a web service call to
update tables on a Web Server running SQL Server 2000.
2. The Update is updating about 1000 - 3000 records doing simple update
statements like "Update...
|
by: Nevyn Twyll |
last post by:
I've been working on an asp.net application and everything's been great.
But suddenly, whether I'm tyring to use a database on my own machine, or on
my server, I'm getting a timeout when trying to open a database connection.
The error seems to happen regardless of what ASP.NET app I'm working
with/trying to debug.
It will open a few connections,
Here's the error:
| |
by: Nathan |
last post by:
I have an aspx page with a data grid, some textboxes, and an update button.
This page also has one html input element with type=file (not inside the data
grid and runat=server).
The update button will verify the information that has been entered and
updates the data base if the data is correct. Update will throw an exception
if the data is not validate based on some given rules. I also have a custom
error handling page to show the...
|
by: Nils Magnus Englund |
last post by:
Hi,
I've made a HttpModule which deals with user authentication. On the first
request in a users session, it fetches data from a SQL Server using the
following code:
using (SqlConnection connection = new
SqlConnection(ConfigurationSettings.AppSettings))
{
|
by: Scorpion657 |
last post by:
Hey I really need help.
I have a Website coded using ASP.NET and VB and for some reason, i'm getting the following error when I try to upload or access a large file which is stored in the database. It was working fine when I was runing the site on the localhost. I added the following line to the web.config file to increase the timeout:
<httpRuntime
maxRequestLength="1048576"
executionTimeout="3600"/>
I also added: connection timeout =...
|
by: Andrew Cooper |
last post by:
Greetings,
I've got a website that has several pages with DataGrid controls on
them. The controls are bound to Object Datasources. On one of the
pages I keep getting a "Timeout expired. The timeout period elapsed
prior to completion of the operation or the server is not responding."
error. The data is being filled from a Stored Procedure on an SQL
Server. When I run the Stored Procedure on the actual server, it is
only taking 24...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: 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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |