|
 |
aspx_beginners thread: 3 questions
Message #1 by soni29@h... on Sat, 9 Mar 2002 16:22:06
|
|
hi, i had 3 different questions about ASP.net:
1) Is there anyway to shut off iis? the text mentioned that it always
turns on when the pc is turned on, but what if i want to shut it off? i
have to learn jsp for a class and need to install apache, server, so i
need to turn iss off at times.
2) In the text there are times when the authors use the Sub Page_Load
function in different ways, such as:
Sub Page_Load()
Sub Page_Load(Source As Object, E As EventArgs)
my question is when to use which? why would you need the second one?
what events could be generated when the page is loading?
3) In the text (beginning asp.net using vb.net) on page 361 the authors
wrote the following code:
Sub Page_Load(Source As Object, E As EventArgs)
If Not IsPostBack Then
MyButton.Text = "Save Cookie"
MyDropDownList.Items.Add("Blue")
MyDropDownList.Items.Add("Red")
MyDropDownList.Items.Add("Gray")
End If
End Sub
My question was why did they use IsPostBack? don't they want this to
happen everytime a person comes to the page? why would someone make a
button and list and not put anything into it?
thank you.
Message #2 by "Paul Birch" <paulbirch@b...> on Sat, 9 Mar 2002 16:39:55 -0000
|
|
Hi,
I'll have a go at answering one and three for you...
1) The IIS server is a Windows service, and as such you can control it's
startup and whether it runs automatically by using the services program from
Administrative tools in the Control panel.
Look for the Name "World Wide Web Publishing, and click on it to open the
porperties. There is a Startup drop-down box on the General tab of the
property dialog, and it is normally set at "Automatic", you can set this to
either manual (meaning you have to go and start it yourself) or Disabled
(speaks for itself).
2) Not sure about this, but there may be times when you need to check the
event args to see if the windows is a popup spawned from another window for
instance. I'm assuming that would produce an event arg (possibly the ID of
the parent window). This is all supposition so don't hold me to any of
this.
3) IsPostBack is used here just to give a little boost to the performance of
your pages. The first time you run the page it will populate the control,
and then because of the stateful way that ASP.NET maintains the page, when
you go back to the page the control will still have the populated items you
have provided. Try it, take out the IsPostBack check and run the program,
you will see duplicated items (ie the dropdown will have 2 Blues, 2 Reds and
2 Greys).
Hope this helps,
Paul
----- Original Message -----
From: <soni29@h...>
To: "aspx_beginners" <aspx_beginners@p...>
Sent: Saturday, March 09, 2002 4:22 PM
Subject: [aspx_beginners] 3 questions
> hi, i had 3 different questions about ASP.net:
>
> 1) Is there anyway to shut off iis? the text mentioned that it always
> turns on when the pc is turned on, but what if i want to shut it off? i
> have to learn jsp for a class and need to install apache, server, so i
> need to turn iss off at times.
>
> 2) In the text there are times when the authors use the Sub Page_Load
> function in different ways, such as:
> Sub Page_Load()
> Sub Page_Load(Source As Object, E As EventArgs)
> my question is when to use which? why would you need the second one?
> what events could be generated when the page is loading?
>
> 3) In the text (beginning asp.net using vb.net) on page 361 the authors
> wrote the following code:
>
> Sub Page_Load(Source As Object, E As EventArgs)
> If Not IsPostBack Then
> MyButton.Text = "Save Cookie"
> MyDropDownList.Items.Add("Blue")
> MyDropDownList.Items.Add("Red")
> MyDropDownList.Items.Add("Gray")
> End If
> End Sub
>
> My question was why did they use IsPostBack? don't they want this to
> happen everytime a person comes to the page? why would someone make a
> button and list and not put anything into it?
>
> thank you.
$subst('Email.Unsub').
Message #3 by "Minh T. Nguyen" <nguyentriminh@y...> on Sat, 9 Mar 2002 11:03:26 -0800
|
|
Hi there,
1) You can shut down IIS in the dos prompt with "net stop
iisadmin". Or you can go to the Services snap-in by going to
Administrative Tools/Services. There you can start/stop "IISAdmin" or
even set it to "manual" or "disabled" to prevent it to run on every
start up.
If you want to shut it down programmatically, you can use the
IIS Admin COM objects. This can be done from VB, C++ and event with the
.NET classes using the Active Directory stuff. See
http://msdn.microsoft.com/library/en-us/iisref/html/psdk/asp/aint7e9l.as
p.
Minh.
-----Original Message-----
From: soni29@h... [mailto:soni29@h...]
Sent: Saturday, March 09, 2002 4:22 PM
To: aspx_beginners
Subject: [aspx_beginners] 3 questions
hi, i had 3 different questions about ASP.net:
1) Is there anyway to shut off iis? the text mentioned that it always
turns on when the pc is turned on, but what if i want to shut it off? i
have to learn jsp for a class and need to install apache, server, so i
need to turn iss off at times.
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
Message #4 by allan@a... on Sat, 30 Mar 2002 16:20:23
|
|
I will try to help with #2,
The declaration of the page_load function differs when there are differing
requirements for the function to operate. In the first instance, there is
no outside information needed for the function to operate. In the second,
the function requires outside information to properly function. This is
called passing parameters to the function.
For example, say that you wanted the user to log in in one form, then,
based on the permission level as retrieved from a database, to configure
what the user is able to see on the next form, you would do something like
this
sub page_load(userPermission as long)
...run code to setup the form based on the value of userpermission...
end sub
note that you could also just replace this with something like this
sub page_load()
... get the user permission based on user from the database
... now run the code
end sub
* the problem here is maintainability. you could wind up writing the code
to get the user permission hundreds of times and including it in each
form, this way, you would only have to write it once, and pass it to the
form, then use it in page_load.
this is a simplistic example, in the real world, nothing is ever this easy.
Hope this helps clarify the sitution
-->Allan
> hi, i had 3 different questions about ASP.net:
>
> 1) Is there anyway to shut off iis? the text mentioned that it always
> turns on when the pc is turned on, but what if i want to shut it off? i
> have to learn jsp for a class and need to install apache, server, so i
> need to turn iss off at times.
>
> 2) In the text there are times when the authors use the Sub Page_Load
> function in different ways, such as:
> Sub Page_Load()
> Sub Page_Load(Source As Object, E As EventArgs)
> my question is when to use which? why would you need the second one?
> what events could be generated when the page is loading?
>
> 3) In the text (beginning asp.net using vb.net) on page 361 the authors
> wrote the following code:
>
> Sub Page_Load(Source As Object, E As EventArgs)
> If Not IsPostBack Then
> MyButton.Text = "Save Cookie"
> MyDropDownList.Items.Add("Blue")
> MyDropDownList.Items.Add("Red")
> MyDropDownList.Items.Add("Gray")
> End If
> End Sub
>
> My question was why did they use IsPostBack? don't they want this to
> happen everytime a person comes to the page? why would someone make a
> button and list and not put anything into it?
>
> thank you.
|
|
 |