473,404 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,404 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 1117

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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.