472,378 Members | 1,242 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,378 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 1384
"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: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

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.