473,386 Members | 2,114 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,386 software developers and data experts.

Caching WebControl

When I use the partialcaching attribute on my custom control (not a user
control) it really doesn't seem to do anything at all and I'm wondering what
the proper way to do ths is? Here is the code I'm trying. I don't have a
clue how to do this so any help would be great. The part enclosed in
asterisks is the first attemo. It didn't throw any exceptions but I would
always get " not cached" in the HTML source.

Thanks for any help,

Jason MacKenzie
<PartialCaching(500)> _
Public Class ConstructTopMenuBar
Inherits System.Web.UI.WebControls.WebControl


Protected Overrides Sub Render(ByVal output As
System.Web.UI.HtmlTextWriter)
With oMenu

.ServerName = Page.Request.ServerVariables("server_name")

.IPAddress = Page.Request.ServerVariables("REMOTE_HOST")

.UserName = Page.Request.ServerVariables("logon_user")

.LoadPageInfo(Page.Request.ServerVariables("url"),
_ExecuteSecurity)

If _ExecuteSecurity = True Then
If .HasAccessToPage = False Then
MailSecurity()
Page.Response.Redirect("http://" &
Page.Request.ServerVariables("Server_Name") & "/intranet/securityNet.asp")
End If
End If

'************************************************* *************
' Dim cachedOutput As Object = context.Cache("TopMenuBar")

'If Not IsNothing(cachedOutput) Then
'output.Write(cachedOutput.ToString & " CACHED")
'Else

Dim strOutput As String = .ConstructTopMenuBar()

' context.Cache.Add("TopMenuBar", strOutput, Nothing,
Today.AddMinutes(2), TimeSpan.Zero, Web.Caching.CacheItemPriority.High,
Nothing)

'output.Write(strOutput & " not cached")
output.Write(strOutput)
' End If
'************************************************* **************
End With

oMenu.Dispose()
oMenu = Nothing

End Sub


End Class
Nov 18 '05 #1
0 1115

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

Similar topics

1
by: Owatona | last post by:
Hi to all... I have 3 classes derived from webcontrol. I the first i have two dropdownlist, in the second i have some buttons, and the third its the webcontrol that are instanciate the two...
0
by: Matze | last post by:
I have a function that has an Argument of type System.Web.UI.WebControls.WebControl. I want to set the text-property of that control. Of course it doesnt work if I cast that control to...
0
by: Harry F. Harrison | last post by:
Here's the situation...Context - Using an Inherited WebControl object as a base for server custom controls. In a web custom control, whenever I create a child control and add it to the Controls...
0
by: Jason MacKenzie | last post by:
When I use the partialcaching attribute on my custom control (not a user control) it really doesn't seem to do anything at all and I'm wondering what the proper way to do ths is? Here is the code...
9
by: kw | last post by:
What is the proper way to get the element ID for a client script? For example, suppose in the WebControl: TextBox t=new TextBox; t.ID=this.ClientID+"X"; .... Then elsewhere we want to access...
0
by: Novice | last post by:
Hey all, I've already posted this question and two posters offered suggestions and they worked - but now I would like to know why - and if possible the answer to a second question. Here is my...
1
by: Dariusz Tomon | last post by:
Hi In my project I have got several webcontrol (ascx). How can I handle with the problem: I would like to have some ASPNET object (DropDownList, InputBox etc.) in one webcontrol (this...
4
by: Christian Hofmann | last post by:
Hello, How is it possible to use a hyperlink webcontrol inside a label webcontrol? I am using resources for globalisation. Now I have a text like this: Please click here to open that...
3
by: jlotmar | last post by:
I am currently experiencing a problem whereby browser caching seems to be causing my page to be invalid. I am using a standard DataGrid WebControl which is bound to a DataView object. I use a...
0
by: Charles Mifsud | last post by:
Hi, We have an ASP.NET 2.0 web page with user authentication. We have a page which contains a Multiview with a number of different views. Each view represents one step in a whole process. The...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.