|
-
Sep 18th, 2000, 01:00 PM
#1
Thread Starter
Member
Hi guys,
I have a question, how can declare global variables that can be seen by all ASP pages in a WEB application?? oh .. I forgot, I don't want to use cookkies, because my application is primarily devoted to those browsers which do not support cookies.
I will appreciate your help,
Poor Wesam!
-
Sep 18th, 2000, 01:03 PM
#2
Frenzied Member
You can use server variables. I wouldn't recomend it unless it's a small scale app.
Session variables would be the answer except that sessions depend on cookies (non-persistant ones) to maintain the session id on the client side.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Sep 19th, 2000, 02:07 AM
#3
Thread Starter
Member
Thank you monte96 for your reply, but could you tell me please how can I use Server variables? as far as I know Server variables provide information about the Server itself.
I have to clarify a little bit more, I am developing a WEB application which registers users and retains user's settings, login name, password, .. etc in a database and I need to manipulate these information independently for each user.
I use 'Application' object to store data that are common for all users, but I need somehow to store some data specific for each user and keep these data visible throughout the pages of the application.
Could you help me?
Poor Wesam!
[Edited by Wesam on 09-19-2000 at 03:38 AM]
-
Sep 20th, 2000, 07:21 PM
#4
Frenzied Member
Use a session variable to store the user's ID from the database. It will be maintained for as long as they remain active on the site and will expire by default after 20 mins of no activity.
Keep in mind however, that you will only have access to this information on the server side unless you create some dynamic client side script using response.write to put the value from the session variable into a client side javascript variable.
I don't know what the hell I was thinking about server variables cuz your right, they are read only variables that give you info about the server. (duh!)
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Sep 21st, 2000, 02:32 AM
#5
Thread Starter
Member
But the main idea is that I CAN NOT USE COOKIES!!! I have to find out another way to store global variables for each user accessing my application without using cookies. Session variables depend on cookies and they require a session id which is generated and stored on the client's machine which -in turn- can be switched off by the client!! that's why I have to somehow store the variables using different method!!!
Could you help me,
Poor Wesam!
-
Sep 21st, 2000, 12:21 PM
#6
Frenzied Member
You are correct.
Your only other option then I think is to store the info in a database on the server side and read it in as needed. That would work regardless of cookies, browsers, or otherwise since it is handled totally on the server. You will need to pass the username from page to page using querystrings.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Sep 21st, 2000, 12:25 PM
#7
Thread Starter
Member
Do you know how to do that? i.e. pass many information from one page to another, please note that they are round 11 user variables. Also some of them should not be shown to the user (in the query string) like password, some ID and few others.
Is there an effcient method?
Waiting for your help ...
Poor Wesam!
-
Sep 21st, 2000, 12:49 PM
#8
Frenzied Member
idea
dont know how well this wroks or if it works
but you can have a file with all your variables declared
and include it with all your asp pages
-
Sep 21st, 2000, 01:35 PM
#9
Frenzied Member
Why would you pass the password to many pages? Once they are logged in, you shouldn't need it.
The best thing to do is this:
Setup a database that contains all of the info you need on each page.
Once they log into the web app, create dynamic client side script that is written by the server side code using response.write to set up the userid (primary key for that user in the database) as a variable on the client side. Use this variable on the client side to pass it as a querystring to each page after that. You will need to include code in each page that does the same creation of dynamic code.
Now, if you tell me that no client side script is allowed, that will put a whole new paint job on things...
Then, you will need to create your HREF tags on each page to include the '?id=blahblah' querystring so the id is passed to each page. That may actually be the easiest way to do it. Also, if you have a form with a submit button, make sure that you write your id value into a hidden textbox within the form so it will be passed to the page receiving the form data.
Using a file will be alot slower and difficult to maintain. I'm assuming if you have users they are logging in so that means you have to have them stored in a database so your half way home right there...
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|