Programmatically Cache An Image Using VB Code Behind?
Aug 18, 2010Is it possible to programmatically cache an image using VB code behind? If so, can someone lead me in the right direction?
View 14 RepliesIs it possible to programmatically cache an image using VB code behind? If so, can someone lead me in the right direction?
View 14 RepliesI have a server control that I developed which generates navigation based on a third party CMS API. Currently I am caching this control using the PartialCaching attribute. The CMS uses cache key dependencies to invalidate the cache when a user makes an edit, however in the case of my server control it does not get invalidated and the updated navigation will not show up until the cache expiration set by the PartialCaching attribute.Here is my two part question:
What is the proper way to programmatically cache a server control, without using the PartialCaching attribute, and adding a cache key dependency?
Is it possible to continue to use the PartialCaching attribute and add a cache key dependency?
UserControl: How to set Output Cache duration programaticaly?
View 2 RepliesI want to use an Enum value for the types of VaryByCustom parameters I will support, is it possible to do this?
I tried setting it in the page itself
<%@ OutputCache Duration="600" VaryByParam="none"
VaryByCustom='<%=VaryByCustomType.IsAuthenticated.ToString(); %>' %>
But this returned the entire literal string "<%=VaryByCustomType.IsAuthenticated.ToString(); %>" inside my global.asax is there any way to do this either on the page itself or from the codebehind? Or is this just something I have to accept is purely magic strings and nothing I can do to add type safety to it?
I'm trying to cache user controls and on some pages i want to cache single objects. There are multiple ways of implementing caching, and my head is breaking over it.
The way I see the caching options now:
You have the PartialCaching option which is set to cache the control for 30 minutes, and after that it clears itself... You have the varyByParam to identity the page by its querystring paramaters... or other vary options
But i just cant find an appropriate way to add caching to a control, and be able to clear the caching programmatically when i update one of the objects used in the control from the backend.
You can do HttpContext.Current.Cache.Insert(), which accepts a key on which you can destroy the caching item later by using remove... This can save objects in cache but can you use options like varyByParam?
My questions are burnt down to two:
Is there a way to clear the caching on specific user controls from the code? If yes, can this be done according to the varyby options? How would the object caching respond to logged in users or anonymous users using Insert()?
EDIT: I'm caching multiple things.... And I'm really flabbergasted in which choice to make referring to caching. Can the Cache.Insert be varied by Parameters?
The main problem is peopling editing things from the backend, which needs to trigger an event that reinstantiates or clears all caching items referring that object.
I'm using an outside page to update an image in my system. When I'm redirected back to the page I've worked in, I still see the old picture. I don't see my changes until I press ctrl+f5.
View 2 Repliesi am using Jcrop to give users the option to crop there images, i have hit a small caching problem.
if you open an image which is already on the server and crop it. my jcrop works and crops the image fine but when i reload the image the old version is displayed. i have this inside an update panel.
so is there a way of removing the browsers cache before i reload the image?
where external files / images are being loaded from. By this I mean that I'm aware that external JS files / Images are cached on the first load of a page. What I'd like to have is a tool that confirms to me that on subsequent requests these files are in fact being loaded from the users cache rather than downloading the file again.
View 3 RepliesUsers can edit images downloaded from my site and then upload them back using a WCF Web Service. The problem is when users go to view images, they often do not see the latest versions because of caching. I'd rather not turn off the cache because it substantially reduces bandwidth. Is there a way to have the Web Service perform some action upon an upload to notify the next web client call that the image has changed?
View 2 RepliesI am using this tag to hepl with my database calls <meta http-equiv="cache-control" content="no-cache" /> however I would like to override this meta tag for one large image using asp.net.
View 1 RepliesMSVS 2005 asp.net 2.0 ajax enabled site..
I havent used asp.net 2.0 rsskit..didnt know there wasone..
anyways.. I have this RSS code that pulls RSS contents from a stored proc into a dataset (ds)..
Question : How can I cache the Dataset variable (ie ds) so that if I have 100 hits in 5 min I dont get 100 pulls on the stored proc. [NOTE: I assume its best to cache the dataset]
my code for RSS from the dataset (note has a few custom function etc..)
[Code]....
I have a menu on my site that changes depending on whether the user is logged in or not. With browser caching, the menu "gets stuck" in either state and is confusing to users.They'll login, but the menu won't update because it's still cached in the unauthenticated state... and vice versa.How is this typically handled? Can we refresh the user's browser cache from our code? Or do I just not allow browser caching? (would rather use it, very nice bump in speed).UpdateHere's how I set client-side, browser caching in my asp.net mvc 2 app:
public class CacheFilterAttribute : ActionFilterAttribute {
/// <summary>
/// Gets or sets the cache duration in seconds. The default is 10 seconds.
[code]...
I have a asp.net web application and I'm using cache (HttpRuntime.Cache) to save some stuff from db.
I also update db from time to time so that data in db does not match the data in my application's cache.
Is there any way how to clear my application's cache without modifying any source code or republishing the page?
I tried to restart IIS and to clear browsers cache
How to save image from another website programmatically? Using asp.net c# for example I wouldlike to create request on Google to search something for example beer and from search result save images using asp.net web application
View 2 RepliesI am working on page where data will update in every 10 second by scraping data from other Stock website. So basically page is displaying stock data which update in every 10 seconds. I am using update panel and timer control. Now problem is that if 100 users open the webpage 100 request go server in each 10 seconds. I want to implement Cache on page where Cache version of page serves to other user. I am using <%@ OutputCache Duration="10" VaryByControl="Timer1" %> but when event occur code run intends of delivering Cache version of page. What I am doing for test.
1) Open page in different browser in local
2) Checking browser type using code
Dim s As String = ""
With Request.Browser
s &= "IP = " & HttpContext.Current.Request.UserHostAddress & vbCrLf
s &= "Browser Name = " & .Browser & vbCrLf
End With
Label1.Text = s
if page first open in IE then if I again open in firefox it shows browser type IE but after 10 sec interval it will update type to firefox. So I want to display Cache data only instead of executing server side code for each different browser.
I have a tree view which has files inj its leafnodes.
I would like to set the leafnodeimage programmatically as a function of the file extension.
I am working on a localization project, some of the localized text are in graphics, some of the example graphics paths:
/en/images
/es/images
/fr/images
My web forms use <asp:image> controls and <img> tags (runat = sever) to point to graphics in /en/images. I need to a function to loop through all image control and point them to different paths based on the locale set at runt time. Which event should I override and how do I write it?
All my web pages inherit from a base page, I don't know if that makes differences.
[Code]....
How to prevent browser from caching image, Trsponse.Cache.NoStore didn't work
I know how you can set an tag's url attribute programmatically in c#, but it seems when I try to access the image element inside of a tag I cannot access it. The is residing in the <AlternatingItemTemplate>. NOTE: I am only having this issue inside the <AlternatingItemTemplate> Now the ListView tag is also databound.(this is probably why I cannot access, because it isn't guaranteed that it will even exist perhaps). How can I get around this so that I can display my images programmatically or is there a better solution?
<asp:ListView ID="ListView_Comments" runat="server"
DataKeyNames="ReviewID,ProductID,Rating" DataSourceID="EDS_CommentsList">
<ItemTemplate>
<tr style="background-color:#EDECB3;color: #000000;"> <td><%# Eval("CustomerName") %></td>
<td> <img src='Styles/Images/ReviewRating_d<%# Eval("Rating") %>.gif' alt="">
<br />
</td>
<td> <%# Eval("Comments") %>
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr style="background-color:#F8F8F8;"> <td><%# Eval("CustomerName") %></td>
<td>
<img id="rateImage" src="" alt="" runat="server" />
......
I'm using varbinarymax.....IN SQL gridview image and setting the nullimage value doesn't this problem.. I'm looking for code that can make this lil miracle happen
& it doesn't really matter which way , whether the code says if image null then display this image from ~/Images/thispic.jpg or if i1 display this image from ~/Images/thispic.jpg for a little bit more insight into this I'm creating a legend for the database and the null has been used for displaying one pic so i'm after the 1 or visa versa to display another image.... and i'm not trying to upload pics to 1000 plus documents, and when i came at it from a sql angle tying 5 tables together the parent table ended up not sending the proper return. is this even possible or am i ahead of visual studio
I have a list of image names stored in a database, along with the id of the property they are associated with. I'd like to be able to display all of the images in a gridview and then allow the user to select the required image.
The problem I'm having is that the gridview is not displaying. I'm pretty sure it's something basic that I've missed, but can't for the life of me see what it is!
My gridview code in my aspx page:
[Code]....
My code behind (propId is the property id):
[Code]....
I am writing an application that does it's own logging in a SQL table. On each page, I statically assign this variable: Dim page = "page_01.aspx" I've noticed that page is ALWAYS equal to the name of the Partial Class of the code-behind + the suffix ".aspx" Is there any way to programatically set the string to equal the name of the Partial Class, so I don't have to statically code it on each page? Basically, I want to assign the name of the current class to a string, and append ".aspx" to it. Can I do this, or does that get lost in the compilation?
View 1 RepliesI want to have my web site localized to 3 languages english, spanish, french.
Is it possible by clicking the flags on the home page set the globalization culture tweak, in flag image click?
I have a modalpopupextender that I want to run based on a timer control. I've tried using the clientregisterscript to run some javascript code to perform a fake click on the link control that initiates the modalpopup, but with no luck. What is the best way to either show the modal dialog programatically or register a jscript that will do this.
View 2 RepliesI have a div runing on server in which i programmatically add images. On post back, id like to get some attributtes from those images, but they are nowhere to be found. What am i doing wrong?
[Code]....
[Code]....