| |

VerySource

 Forgot password?
 Register
Search
View: 1649|Reply: 12

Web development using global variables

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-9 12:00:01
| Show all posts |Read mode
In Asp.net's web development, how to implement a defined global variable (such as user ID) can also be read in other interfaces! 1) I used Session and Cookie to solve it, but I encountered the problem of timeliness with Session, and it was not safe to use Cookie, so I could only give up in the end. 2) Now use FormsAuthentication that comes with .Net to achieve. Although the function is implemented, the problem of timeliness is also solved. But a bit tedious.
3) Excuse me, is there any good way to solve it?
Reply

Use magic Report

0

Threads

11

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-5-30 15:30:01
| Show all posts
You can use session, combined with asp.net state service, and then use hidden iframe to automatically submit to solve the problem of session timeliness.
Reply

Use magic Report

0

Threads

26

Posts

20.00

Credits

Newbie

Rank: 1

Credits
20.00

 China

Post time: 2020-5-30 16:15:01
| Show all posts
Application variables will do
Reply

Use magic Report

0

Threads

13

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-5-30 16:30:01
| Show all posts
Generally use SESSION
Reply

Use magic Report

0

Threads

17

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-5-30 21:00:01
| Show all posts
Use Session
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-6-1 23:30:01
| Show all posts
What about encrypted cookies?
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-8-3 20:30:01
| Show all posts
Can SESSION solve the problem of timeliness?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-3 23:00:01
| Show all posts
I prefer to use static variables over Application.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-4 10:00:01
| Show all posts
Login interface
                Application("Yonghuming") = Trim(reader("Username"))
Application interface
Dim yonghuming
        yonghuming = Application("Yonghuming")
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-4 10:45:01
| Show all posts
User login is personal information, so
It is not the correct choice to use Application and static variables. Generally, the global variable to save personal information is SESSION/cookies
Viewstate at the page level
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list