Events in ASP.Net Page request

A

anoop

Hello,
I am generating the random number and adding the value of random
number to a user defined cookie, whose path is defined in web application
root. I am adding the cookie using Response.Add at the page load event and
the page_loadcomplete event. Now I want to know that in every request of the
page, these events will be fired on not with the "autoeventwireup=true" ,
also what other events should be used so that in every request , cookie has a
random value.

Thank you
 
P

Patrice

Unclear but you could have all your page inheriting of a parent page (for
now it seems you want to have this code in each and every page ?).

If this is already coded properly in base page it will always run (not
handling the event at some level doesn't mean the event doesn't occur so the
base page will always process the event regardless of what the derived page
does (though the derived page could override this behavior but you would
have to do this intentionaly)).
 
A

anoop

Hello,
I mean, I have implemented the following code already

1. autoeventwireup="true" in Page directive
2. calling random number functions in Page_Load
3. calling random number functions in Page_Loadcomplete

now what other events should I use so that number set in the cookie will be
random in each page request.

Thank you
 
A

anoop

Hello,
I am creating only one random number and setting it in only one
cookie and attaching the cookie to alreading existing ASP.net cookies using
the single function. Now I want that cookie to have different value at each
request of ASP.Net page. What other events should I use

Thank you

Mark Rae said:
[please don't top-post]
http://www.caliburn.nl/topposting.html

I mean, I have implemented the following code already

1. autoeventwireup="true" in Page directive
2. calling random number functions in Page_Load
3. calling random number functions in Page_Loadcomplete

Now what other events should I use so that number set in the cookie will
be
random in each page request.

Let's be clear about this - you are calling random number functions (i.e.
more than one function) in the Page_Load and Page_LoadComplete events...?

How many random functions are you generate...?

How many cookies are you creating...?
 
A

anoop

Hello,
I want random number cookie to be attached to the existing session,
so that the Vulnerabilities like Session Fixation should be removed. I am
attaching uder defined cookie as I cannot regenerate ASP.Net Session ID on
each request. Also during each page request value of the ASP.net page, the
cookie is not changing even if I am calling the random number function on
page_load. I have wriiten the function in another .CS file and that file is
located in App_Code folder.

Thank you

Mark Rae said:
****** [please don't top-post] *******
* http://www.caliburn.nl/topposting.html *
*******************************
I am creating only one random number and setting it in only one
cookie and attaching the cookie to alreading existing ASP.net cookies
using
the single function. Now I want that cookie to have different value at
each
request of ASP.Net page.

A random number is precisely that - random. Every time you call a random
number generator, provided you reseed it correctly as necessary, it will
give you a different number:
http://www.google.co.uk/search?aq=f&sourceid=chrome&ie=UTF-8&q="C#"+random+number

What other events should I use?

??? You say that you need to generate the random number only once per page
request - so pick one of the page events e.g. Page_Load and generate it
there.

I'm curious as to why you think you need to do this more than once...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top