469,156 Members | 2,112 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,156 developers. It's quick & easy.

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;



str = reader.ReadLine();



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





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

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

return myReceipt.getReceiptsDataSet();


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

(fileName,usrWorker,connectionString,new AsyncCallback


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


testDelegate myDelegate = (testDelegate)

Receipt ds = myDelegate.EndInvoke(res);

Session["data"] = ds;

Session["Complete"] = true;


F.- In the dataAdminReceipt.aspx's Page_Load event handler
I'm doing:




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




//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

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

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
Nov 17 '05 #1
1 1269
"Esteban Felipe" <an*******@discussions.microsoft.com> wrote in message
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

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

23 posts views Thread by Jason | last post: by
22 posts views Thread by Jeff Louie | last post: by
29 posts views Thread by Brett | last post: by
reply views Thread by Siegfried Heintze | last post: by
13 posts views Thread by Praveen | last post: by
2 posts views Thread by hcaptech | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.