473,473 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

some questions about asp.net

I have been rewriting a C++ isapi into a C# asp.net application, but because
it was my first one and created within a tight schedule I have some
questions to make sure if I did it right.

1. Does asp.net create a new instance of the Page class for every request?

2.
I created a class for the settings of the application, meaning that I have
static instance holding a reference to the settings object. I'd say that
this will store one object for all users (or at least I hope so) Can I do
this or will static class members get removed when a client's session
expires?

example:
public class App : System.Web.UI.Page
{
private static SomeClass data; // do I have server side status now?
private void Page_Load(object sender, System.EventArgs e) { if (data ==
null) data = new SomeClass(); }
}

3.
the Page_Load is executed every time a request is done. What I have done is
call my main function in Page_Load, this function fills up a string member
variable. I have overridden Page.Render to write that string to the output.
Is this the correct way or is iot better to just use Page.Response.Write
like in asp?

4.
Can I change the content-type as much as I want or can I do this only once
in Render?

5.
The machine.config file holds information about worker threads and IO
threads per cpu and the request queue length.
What's the difference between a worker thread and IO thread here?
Does every thread have a request queue or is there only one?

6.
I think I know the answer to this one already but I'll ask anyway. Is
asp.net implemented that it takes threads from the global IIS thread pool or
does it implement its own pool and hands out threads from that one?

Thanks for reading if you've come this far :-)

--
Looking for a C(99) compiler for windows?
Download lccwin32.
http://www.cs.virginia.edu/~lcc-win32/
Nov 18 '05 #1
2 1140
Comments inline:

"Servé Lau" <i@bleat.nospam.com> wrote in message
news:bq**********@news1.tilbu1.nb.home.nl...
I have been rewriting a C++ isapi into a C# asp.net application, but because it was my first one and created within a tight schedule I have some
questions to make sure if I did it right.

1. Does asp.net create a new instance of the Page class for every request?
Yes. As HTTP is stateless, the Page class must be re-created with each
Request.
2.
I created a class for the settings of the application, meaning that I have
static instance holding a reference to the settings object. I'd say that
this will store one object for all users (or at least I hope so) Can I do
this or will static class members get removed when a client's session
expires?

example:
public class App : System.Web.UI.Page
{
private static SomeClass data; // do I have server side status now?
private void Page_Load(object sender, System.EventArgs e) { if (data ==
null) data = new SomeClass(); }
}
Static objects exist in the heap, which means that they live for the
lifetime of the web application.
3.
the Page_Load is executed every time a request is done. What I have done is call my main function in Page_Load, this function fills up a string member
variable. I have overridden Page.Render to write that string to the output. Is this the correct way or is iot better to just use Page.Response.Write
like in asp?
Neither. ASP.Net is object-oriented, and Response.Write is procedural.
Depending upon what this string is, and what function it serves, you might
want to put it into a Label, Placeholder, Web User Control, or some other
container class for HTML.
4.
Can I change the content-type as much as I want or can I do this only once
in Render?
How many ContentTypes do you think one Response can have? (Answer: one)
5.
The machine.config file holds information about worker threads and IO
threads per cpu and the request queue length.
What's the difference between a worker thread and IO thread here?
Does every thread have a request queue or is there only one?
??? I don't understand what you're trying to get at here. There is only one
Request Queue, and it is managed by IIS. It is used to queue HTTP requests
that arrive while there are no avialable threads to process them.
6.
I think I know the answer to this one already but I'll ask anyway. Is
asp.net implemented that it takes threads from the global IIS thread pool or does it implement its own pool and hands out threads from that one?
I have no idea. If you want to investigate for yourself, here is a link to
the freely-downloadable .Net SDK:

http://www.microsoft.com/downloads/d...displaylang=en

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
Thanks for reading if you've come this far :-)

--
Looking for a C(99) compiler for windows?
Download lccwin32.
http://www.cs.virginia.edu/~lcc-win32/

Nov 18 '05 #2
"Kevin Spencer" <ke***@takempis.com> wrote in message
news:O2**************@TK2MSFTNGP11.phx.gbl...
Static objects exist in the heap, which means that they live for the
lifetime of the web application.
But then this means that an asp.net application does have a state, right?
That is good news BTW.
4.
Can I change the content-type as much as I want or can I do this only once in Render?


How many ContentTypes do you think one Response can have? (Answer: one)


I meant can I call Response.ContentType = "..." as many times as I want? Are
no headers sent or should I call Response.Clear first?
??? I don't understand what you're trying to get at here. There is only one Request Queue, and it is managed by IIS. It is used to queue HTTP requests
that arrive while there are no avialable threads to process them.


Well, you did answer my question :)

--
Looking for a C(99) compiler for windows?
Download lccwin32.
http://www.cs.virginia.edu/~lcc-win32/
Nov 18 '05 #3

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

Similar topics

2
by: Ross Micheals | last post by:
All I have some general .NET questions that I'm looking for some help with. Some of these questions (like the first) are ones that I've seen various conflicting information on, or questions that...
12
by: Vibhajha | last post by:
Hi friends, My sister is in great problem , she has this exam of C++ and she is stuck up with some questions, if friends like this group provides some help to her, she will be very grateful....
1
by: Tony Johansson | last post by:
Hello Experts! I have some questions about inheritance that I want to have an answer to. It says "Abstract superclasses define a behavioral pattern without specifying the implementation" I...
162
by: techievasant | last post by:
hello everyone, Iam vasant from India.. I have a test+interview on C /C++ in the coming month so plz help me by giving some resources of FAQS, interview questions, tracky questions, multiple...
50
by: Jatinder | last post by:
I 'm a professional looking for the job.In interview these questions were asked with some others which I answered.But some of them left unanswered.Plz help. Here are some questions on C/C++, OS...
24
by: Kevin | last post by:
Hey guys. I'm looking to get together some VB programmers on Yahoo messenger. I sit at a computer and program all day. I have about 3 or 4 people already, but it would be really cool to have a...
7
by: changs | last post by:
Hi, all I have a asm code, I suspect it sort of socket programming. Can anyone here give some instructions on how to determine the function or give the psudo-code in C? Thanks in advance! ...
3
by: iKiLL | last post by:
Hi all I am building an Windows Mobile 5 forms control in C#, for a Windows Mobile 5 application. I am using CF2.0 and SQL Mobile 2005. The control is a Questions and answer control.
4
by: Mr. X. | last post by:
Hello. I need some help, please. What can an employee ask (technical questions), if I am interviewed of Dot-net developer (also VB.NET and C#). (What are the most general questions, that I may...
30
by: GeorgeRXZ | last post by:
Hi Friends, I have some questions related to C Language. 1What is the difference between the standard C language and Non standard C language ? 2which is better C Lanugage, C under Linux/...
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
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
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...
1
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...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.