473,799 Members | 3,061 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# threading in ASP.Net

Is this safe? Any pitfalls? I have done threading in regular C# apps,
but haven't had a needs to do threading in ASP.Net, until now.

The issue I have ran into is this: Our corporate portal application
displays the logged in users 10 most recent emails from Exchange via
WebDav. The current code is in legacy VB6 and needs to be ported
*really* bad. Exchange 2003 has an issue where it only allows a max of
256 WebDav connections from one account. We used one "master" account
to authenticate against Exchange that could read any users mailbox. We
have 1,000's of employees and we exceeded the 256 connection limit. So
we added another "master" user with read access and then a third and we
round-robin between those.

The main issue is that we are getting some exchange bug where if
exchange goes down or has an issue during a request, the WebDav code
blocks until the portal timeout occurs and no one can get into the
portal. Employees need to always be able to get into the portal, even
if email is down. The portal is the gateway to most corporate apps for
all the non-technical users. The portal is PeopleSoft Portal. The way
PeopleSoft creates the home page with all the "pagelets" is that the
PeopleSoft Portal goes and makes the requests for the pages in the
background like a proxy server. It then puts all the pieces together
and runs the HTML through HtmlTidy to "fix" the broken HTML (remove
multiple <head><body> etc). Not the best method, but I cannot change
that. So if one of the "pagelets" takes too long, the whole stinking
PeopleSoft portal home page times out and prevents login.

I need to change it so that users can get into the portal even if there
is a timeout. I already ported the code to C# to do all the WebDav. I
get the emails back fine. I set the timeout property on the
HttpWebRequest object to 5 seconds. However, I need to be certain that
the method will always return in 5 seconds or less so I do not want to
only rely on the timeout property of the HttpWebRequest object.

I was going to write a wrapper function that creates a new thread. That
function in the thread does all the WebDav stuff. If that thread hasn't
returned in 5 seconds, the wrapper function just calls abort and returns
an empty XML response.

Will I run in to any threading issues with threading under ASP.Net? Is
the timeout property of the HttpWebRequest object *dependable*? Or
should I do the threading approach?

Thanks for any feedback,

Jim
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
There's no place like 127.0.0.1
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
JimD
Central FL, USA, Earth, Sol
May 30 '06 #1
4 2005
JimD,

I don't see why you would use another thread. If you are getting the
response, and you set the timeout for five seconds, an exception should be
thrown indicating that the timeout occured.

Also, you have asked if the timeout property of the HttpWebRequest class
is dependable. Is there any reaosn why you would think it isn't?

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"JimD" <Ji*@keeliegirl .dyndns.org> wrote in message
news:4I******** **********@torn ado.tampabay.rr .com...
Is this safe? Any pitfalls? I have done threading in regular C# apps,
but haven't had a needs to do threading in ASP.Net, until now.

The issue I have ran into is this: Our corporate portal application
displays the logged in users 10 most recent emails from Exchange via
WebDav. The current code is in legacy VB6 and needs to be ported
*really* bad. Exchange 2003 has an issue where it only allows a max of
256 WebDav connections from one account. We used one "master" account
to authenticate against Exchange that could read any users mailbox. We
have 1,000's of employees and we exceeded the 256 connection limit. So
we added another "master" user with read access and then a third and we
round-robin between those.

The main issue is that we are getting some exchange bug where if
exchange goes down or has an issue during a request, the WebDav code
blocks until the portal timeout occurs and no one can get into the
portal. Employees need to always be able to get into the portal, even
if email is down. The portal is the gateway to most corporate apps for
all the non-technical users. The portal is PeopleSoft Portal. The way
PeopleSoft creates the home page with all the "pagelets" is that the
PeopleSoft Portal goes and makes the requests for the pages in the
background like a proxy server. It then puts all the pieces together
and runs the HTML through HtmlTidy to "fix" the broken HTML (remove
multiple <head><body> etc). Not the best method, but I cannot change
that. So if one of the "pagelets" takes too long, the whole stinking
PeopleSoft portal home page times out and prevents login.

I need to change it so that users can get into the portal even if there
is a timeout. I already ported the code to C# to do all the WebDav. I
get the emails back fine. I set the timeout property on the
HttpWebRequest object to 5 seconds. However, I need to be certain that
the method will always return in 5 seconds or less so I do not want to
only rely on the timeout property of the HttpWebRequest object.

I was going to write a wrapper function that creates a new thread. That
function in the thread does all the WebDav stuff. If that thread hasn't
returned in 5 seconds, the wrapper function just calls abort and returns
an empty XML response.

Will I run in to any threading issues with threading under ASP.Net? Is
the timeout property of the HttpWebRequest object *dependable*? Or
should I do the threading approach?

Thanks for any feedback,

Jim
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
There's no place like 127.0.0.1
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
JimD
Central FL, USA, Earth, Sol

May 30 '06 #2
Nicholas Paldino [.NET/C# MVP] wrote:
Also, you have asked if the timeout property of the HttpWebRequest class
is dependable. Is there any reaosn why you would think it isn't?
Well, we currently set the timeout to 10 seconds in the legacy VB6 COM
object that handles the WebDav communication. The COM object uses the
MSXML2.ServerXM LHTTP object. When Exchange locks the request, it is a
hard lock and the request never returns and 90 seconds later the whole
portal login times out because the email pagelet never finished since
the COM object never returned. The email pagelet and COM object are
both legacy VB6/ASP that I am happily moving to C#/.Net.

Our admins have worked with MS on this issue. I think we will get a
patch, some day....

However, until then we need our portal to be functional and not timeout
due to an Exchange WebDav issue.

Since the request made by the MSXML2.ServerXM LHTTP object gets locked
and doesn't honor the timeout value, I was thinking that the same thing
could happen with the HttpWebRequest object.
Hope this helps.


Thanks,

Jim
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
There's no place like 127.0.0.1
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
JimD
Central FL, USA, Earth, Sol
May 30 '06 #3
Jim,

Well, it depends on whether it is an issue with the Exchange server (or
rather, IIS which is hosting WebDAV for exchange) or the ServerXMLHTTP
object.

I believe that the timeout property of the HttpWebRequest object is
going to properly tell you if something timed out.

Of course, you could always ^try^ it rather easily, no? What happens
when you try?>

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"JimD" <Ji*@keeliegirl .dyndns.org> wrote in message
news:Kj******** *********@torna do.tampabay.rr. com...
Nicholas Paldino [.NET/C# MVP] wrote:
Also, you have asked if the timeout property of the HttpWebRequest
class
is dependable. Is there any reaosn why you would think it isn't?


Well, we currently set the timeout to 10 seconds in the legacy VB6 COM
object that handles the WebDav communication. The COM object uses the
MSXML2.ServerXM LHTTP object. When Exchange locks the request, it is a
hard lock and the request never returns and 90 seconds later the whole
portal login times out because the email pagelet never finished since
the COM object never returned. The email pagelet and COM object are
both legacy VB6/ASP that I am happily moving to C#/.Net.

Our admins have worked with MS on this issue. I think we will get a
patch, some day....

However, until then we need our portal to be functional and not timeout
due to an Exchange WebDav issue.

Since the request made by the MSXML2.ServerXM LHTTP object gets locked
and doesn't honor the timeout value, I was thinking that the same thing
could happen with the HttpWebRequest object.
Hope this helps.


Thanks,

Jim
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
There's no place like 127.0.0.1
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
JimD
Central FL, USA, Earth, Sol

May 30 '06 #4
Nicholas Paldino [.NET/C# MVP] wrote:
Of course, you could always ^try^ it rather easily, no? What happens
when you try?>


I haven't tried it yet. I want to get as many test case scenarios
together as possible. The admins have to come in at night since they
cannot just pull the plug on our production Exchange. I don't want the
poor guys to have to keep coming in to try dozens of small changes.

The issue with Exchange only happens when Exchange goes down or has some
error. So to do a real test, the admins have to pull the plug on
exchange and see if any of the current requests timeout.

We have an isolated test environment. However, we do not have our
PeopleSoft portal in the test environment because it is a big complex
beast and people were having too many issues getting it to run. We also
switched to an Exchange cluster, which we do not have in the test
environment due to hardware costs.

I want to give the admins multiple tests so they can come back to me and
say test case A or B or C worked the best, use that one.

Thanks for the help Nicholas,

Jim
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
There's no place like 127.0.0.1
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
JimD
Central FL, USA, Earth, Sol
May 30 '06 #5

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

Similar topics

65
6765
by: Anthony_Barker | last post by:
I have been reading a book about the evolution of the Basic programming language. The author states that Basic - particularly Microsoft's version is full of compromises which crept in along the language's 30+ year evolution. What to you think python largest compromises are? The three that come to my mind are significant whitespace, dynamic typing, and that it is interpreted - not compiled. These three put python under fire and cause...
2
2994
by: Egor Bolonev | last post by:
hi all my program terminates with error i dont know why it tells 'TypeError: run() takes exactly 1 argument (10 given)' =program==================== import os, os.path, threading, sys def get_all_files(path): """return all files of folder path, scan with subfolders
77
5391
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for the moment. I'd be *very* grateful if people with any interest in multi-threading would read it (even just bits of it - it's somewhat long to go through the whole thing!) to check for accuracy, effectiveness of examples, etc. Feel free to mail...
6
555
by: CK | last post by:
I have the following code in a windows service, when I start the windows service process1 and process2 work fine , but final process (3) doesnt get called. i stop and restart the windows service and the final process(3) gets called. what am I doing wrong with the threading? by the way Directory.GetFiles(IncomingXMLPath1).Length is some global outcome from process 1. Thanks 1)
2
2249
by: Vjay77 | last post by:
In this code: Private Sub downloadBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) If Not (Me.downloadUrlTextBox.Text = "") Then Me.outputGroupBox.Enabled = True Me.bytesDownloadedTextBox.Text = "" Me.totalBytesTextBox.Text = ""
11
5043
by: Paul Sijben | last post by:
I am stumped by the following problem. I have a large multi-threaded server accepting communications on one UDP port (chosen for its supposed speed). I have been profiling the code and found that the UDP communication is my biggest drain on performance! Communication where the client and the server are on the same machine still takes 300ms or sometimes much more per packet on an Athlon64 3000+ running Linux (Fedora Core 5 x64). I must...
17
6437
by: OlafMeding | last post by:
Below are 2 files that isolate the problem. Note, both programs hang (stop responding) with hyper-threading turned on (a BIOS setting), but work as expected with hyper-threading turned off. Note, the Windows task manager shows 2 CPUs on the Performance tab with hyper-threading is turned on. Both Python 2.3.5 and 2.4.3 (downloaded from python.org) have this problem. The operating system is MS Windows XP Professional.
0
1597
by: kingcrowbar.list | last post by:
Hello Everyone I have been playing a little with pyGTK and threading to come up with simple alert dialog which plays a sound in the background. The need for threading came when in the first version i made, the gui would freeze after clicking the close button until pygame finished playing the sound. In Windows it was acceptable because it could be ignored easily, but in
7
2377
by: Mike P | last post by:
I am trying to write my first program using threading..basically I am moving messages from an Outlook inbox and want to show the user where the process is up to without having to wait until it has finished. I am trying to follow this example : http://www.codeproject.com/cs/miscctrl/progressdialog.asp But although the messages still get moved, the progress window never does anything. Here is my code in full, if anybody who knows...
126
6756
by: Dann Corbit | last post by:
Rather than create a new way of doing things: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2497.html why not just pick up ACE into the existing standard: http://www.cse.wustl.edu/~schmidt/ACE.html the same way that the STL (and subsequently BOOST) have been subsumed? Since it already runs on zillions of platforms, they have obviously worked most of the kinks out of the generalized threading and processes idea (along with many...
0
10491
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, 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...
0
10268
jinu1996
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...
1
10247
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,...
1
7571
isladogs
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...
0
6809
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();...
0
5467
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...
1
4146
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
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
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...

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.