473,320 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Run method only on first load?

Here is my scenario:

I have two methods that I only wish to have run the very first time a
user hits the default.aspx page. This page is protected with Forms
protection. default.aspx is the base page for the entire app which
will probably end up being 100 different tools/modules.

The first time the user opens the app, i want to set an Admin object
and load it with their information and save it to the session, then i
have a dropdown dhtml menu that I construct from XML depending on
their permission level. Once this is constructed the first time, i
want to save the javascript used to generate it into the session so on
subsequent hits, the app doesn't have to parse the same xml file over
and over again when it is always going to be the same user until they
log out and log back in.

I thought of doing it in a:
IF NOT (IsPostBack)
routine, but this routine will run more than just the first time the
default.aspx page loads.

How would I accomplish this? I am fairly new to ASP.net and am still
learning the ins and outs.

Thank you for your help!

DKode
Nov 18 '05 #1
1 2638
In global.asax, you can just put this code into the Session_Start method.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"DKode" <dk***@cfl.rr.com> wrote in message
news:b1*************************@posting.google.co m...
Here is my scenario:

I have two methods that I only wish to have run the very first time a
user hits the default.aspx page. This page is protected with Forms
protection. default.aspx is the base page for the entire app which
will probably end up being 100 different tools/modules.

The first time the user opens the app, i want to set an Admin object
and load it with their information and save it to the session, then i
have a dropdown dhtml menu that I construct from XML depending on
their permission level. Once this is constructed the first time, i
want to save the javascript used to generate it into the session so on
subsequent hits, the app doesn't have to parse the same xml file over
and over again when it is always going to be the same user until they
log out and log back in.

I thought of doing it in a:
IF NOT (IsPostBack)
routine, but this routine will run more than just the first time the
default.aspx page loads.

How would I accomplish this? I am fairly new to ASP.net and am still
learning the ins and outs.

Thank you for your help!

DKode

Nov 18 '05 #2

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

Similar topics

24
by: el_roachmeister | last post by:
Is there a way to make a text link post to a form without passing all the parameters in the url? The urls tend to get very long and messy. I often wonder if there is a limit to how long they can...
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
4
by: Gianluca | last post by:
This is the simplified code I'm trying to generate: ilg.DeclareLocal(typeof(int)); // define local integer Label exit = ilg.DefineLabel(); // define "exit" label ...
6
by: johnf401 | last post by:
I've got a VB .NET Web application that has several frames (for discussion sake, let's call them Form1.aspx and Form2.aspx). I want to be able to call a code module in Form2.aspx.vb from code...
2
by: Jeff | last post by:
I am trying to dynamically load an assembly via reflection and then invoke a method of that assembly that will populate a custom type collection passed into the method byref. I am able to...
1
by: Kevin R | last post by:
This is one of the weirdest problems I have ever run into. I have had to trim down a bunch of code to give a sample that is more easily readable by those who will view this. Here is the problem:...
4
by: Eric | last post by:
How to i create a form in tabular format without using wizard. thanks,
4
by: Chris Brat | last post by:
Hi, I've done some reading up but I cant get my head around how/why class methods can be used as apposed to static methods. Can anyone give an example of where they have used class methods? ...
4
by: lakepeir | last post by:
Hello, I have combobox with a selectedindexchanged method that seems to be called when starting the application, launching the form with the combobox and making a change in the drop down box of...
1
by: john20 | last post by:
Hi All, I am having a problem with accesing function in the page. i have a page say user.aspx in the page load method i am calling function to validate the user. it works fine when single...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.