473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Please help.. .can't make this work on win 2k3 (delegates related)

Hi, thanks for reading. I hope to find some help here
before I commit suicide because this is driving me crazy.

Please excuse me if this looks like a long post, but I
hope that a complete explanation help you to help
me :=) ....Let's start with some background:
..- I'm building an asp.net application that requires users
to upload text files in cvs format with data exported from
an AS-400.
..- The files will be something between 800kb and 2mb.
..- I have to parse those files, and get data to fill an
typed dataset.
..- I have to present dataset contents before submitting
anything to database
..- I'm stuck with only asp.net and sql server. I can't
build windows services, use msmq or anything else.

My biggest concern is that the browser can timeout before
i finish all processes. This is what I've done so far:

1.- Built a class that takes a file path as parameter in
the constructor. This class have the following method:
protected ArrayList getLines()

{

reader = File.OpenText(_fileName);

ArrayList array = new ArrayList();

string str;

string[] valuesList;

do

{

str = reader.ReadLine();

if(str!=null)

{

valuesList = str.Split(new char[] {';'});

array.Add(valuesList);

}

}while(str!=null);

reader.Close();

return array;

}

As you can see, this base class handles the file itself,
converting the data to a more friendly arraylist

2.- Built a class that inherits the first class. This
class has a methos (the one that takes long) that iterates
thought all items in the ArrayList. I won't post the code
because is quite large but basicly it takes each item in
the array, examinate the data and invokes several methods
that create new rows inside dataset tables and fill them
with data. At the end returns the filled dataset. This
method recieve as parameter an instance of another class
that manages user data and permissions.

3.- In my web form I've done the following:
A.- declared an delegate (Nomisistemas.Reciept is the
typed dataset, "file" is the uploaded file
path, "Nomisistemas.NSWorker" is the instance of the class
that manages user data, "connectionString" is the
connection string to the database.
public delegate Nomisistemas.Receipt testDelegate(string
file, Nomisistemas.NSWorker worker, string
connectionstring);

B.- in the web form Page_Load event handler i do:
(processReceiptFile is a method that I'll explain later)
myDelegate = new testDelegate(this.processReceiptFile);

C.- The processReceiptFile method is:
public Receipt processReceiptFile2(string fileName,
NSWorker usrWorker, string connectionString)

{

receiptsProcessor myReceipt = new receiptsProcessor
(fileName,usrWorker,connectionString);

return myReceipt.getReceiptsDataSet();

}

D.- In a button event handler, after i've managed the file
upload I do:
Session["Complete"] = false;

myDelegate.BeginInvoke
(fileName,usrWorker,connectionString,new AsyncCallback
(myCallback),myDelegate);

Response.Redirect("dataAdminReceipt.aspx");

E.- myCallback is:
public void myCallback(IAsyncResult res)

{

testDelegate myDelegate = (testDelegate)
res.AsyncState;

Receipt ds = myDelegate.EndInvoke(res);

Session["data"] = ds;

Session["Complete"] = true;

}

F.- In the dataAdminReceipt.aspx's Page_Load event handler
I'm doing:
if(!Page.IsPostBack)

{

if(!Convert.ToBoolean(Session["Complete"]))

{

Response.Write("<META HTTP-EQUIV=Refresh
CONTENT='3; URL='>");

}

else

{

//Continue with the process....

}

}


So what I want to do is to lauch the delegate.BeginInvoke
and go to another page to monitor the value of Session
["complete"], until is true. This idea is not mine, I'm
copying this from this tutorial .

So.. my problems.... This work great on my workstation
(windows xp pro sp1). Here everything run smothly.. But,
when I upload this app to a fresh installation of windows
2003 it fails. But doesn't throw any exception or
complains in anyway.. It just doesn't run. My session
variable never changes. And to make it worst, if I
implement a simpler application that uses this methodology
but doesn't use any of my custom objects IT WORKS ON THE
SERVER!.

I've tried to use threads directly, but also fails. Also
tried to serialize the dataset just to check if it has
something to do with Session variables, but also fails if
I'm doing it in the async way.. If i run it secuencially
(no delegates or threads) it also works in the server
(OMG!)

I've checked permissions, reinstalled the server, made
asp.net an administrator, impersonation to an
administrator, prayed to god and all angels, but no
sucess... any idea?.. please :'(

Thanks for reading again :).. I know you will show me the
light....
Nov 17 '05 #1
1 1440
"Esteban Felipe" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...
Hi, thanks for reading. I hope to find some help here
before I commit suicide because this is driving me crazy.


As soon as you call Response.Redirect, the page you called it from is
destroyed, along with the Request, Response, Context and Server objects.
Since youd delegate is executing after all of this has been destroyed, it
will not have a pleasant time.
--
John Saunders
Internet Engineer
jo***********@surfcontrol.com

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
22
by: Jeff Louie | last post by:
Well I wonder if my old brain can handle threading. Dose this code look reasonable. Regards, Jeff using System; using System.Diagnostics; using System.IO; using System.Threading;
29
by: Brett | last post by:
I'd like to better understand how the following code works. I've posted questions below. namespace Something.Something1 { using System; public delegate void Test1(); public delegate void...
8
by: Nicky Smith | last post by:
Hello, I'm reading Mike Gunderloy's Mcad Vb.net book, and I've also read the MS press Mcad book for the same topic ".. Windows based applications with VB.net" for exam 70-306. In the...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
0
by: Siegfried Heintze | last post by:
I'm practicing for the C# brain bench test by reviewing how delegates work. (Delegates are easy to to with visual studio because you normally use the delegates that some API as already defined. I'm...
13
by: Praveen | last post by:
trying to learn plymorphism. My sample is public class Class1 { public static void Main(string args) { Cls1 x = new Cls1(); Cls2 y = new Cls2(); Cls3 y = new Cls3();
2
by: hcaptech | last post by:
This is my Test.can you help me ? 1.Which of the following statement about C# varialble is incorrect ? A.A variable is a computer memory location identified by a unique name B.A variable's name...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
Oralloy
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.