| |

VerySource

 Forgot password?
 Register
Search
View: 1253|Reply: 10

How to cache a user control permanently?

[Copy link]

1

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-14 20:30:01
| Show all posts |Read mode
Thank you. . .
Reply

Use magic Report

0

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-4-15 14:15:02
| Show all posts
private void Page_Load (object sender, System.EventArgs e)
{
   Response.Cache.SetExpires (DateTime.MaxValue);
}

So that it will never expire
Reply

Use magic Report

0

Threads

13

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-4-21 10:30:01
| Show all posts
You can use OutputCache to set the Duration value to a longer point:
http://chs.gotdotnet.com/quickstart/aspplus/doc/fragmentcaching.aspx
Reply

Use magic Report

1

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-5-1 16:15:01
| Show all posts
Except for longer time.
Is there a better way?
Reply

Use magic Report

0

Threads

13

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 Japan

Post time: 2020-6-3 20:15:01
| Show all posts
Just set it a little longer, why do you have to set it to infinite length? It’s enough for you to set it to one month or one year or two, the time is completely controlled by you.
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-6-6 16:30:01
| Show all posts
Permanent cache is better made static
Reply

Use magic Report

1

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-6-16 13:00:01
| Show all posts
Isn't caching faster than static?
Reply

Use magic Report

1

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-6-16 15:00:01
| Show all posts
All right. It seems no result.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Invalid IP Address

Post time: 2020-6-25 13:30:01
| Show all posts
If you never change, you can use static readonly directly

If you are not sure about variables, use Application[""] when applicating begin
Reply

Use magic Report

1

Threads

18

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2020-6-25 19:45:01
| Show all posts
<%@ OutputCache Duration="100000" VaryByParam="none"%>
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