I am trying to use output caching on my .net pages but it is not working when I use Route handlers to redirect request to actual page, but it works when I call the page directly.
also one more weird thing is that when I am debugging and using .net instance of IIS http://localhost:64293/test it is working, but when I deploy it and try to call the page it is not caching i.e. http://www.mydomain/test(but it works if I call the page directly)
I create custom HTTP handler for auto generating file and I want to tell IIS7 to serve current request like normal static file because I need to use IIS and web.config file to control compression setting and any other HTTP header of current requested file.I know. there is an internal class called StaticFileHandler in ASP.net. But I cannot access it. Or you have any other way to work like this.
i redirect a page from http to https using http module begin request handler .i am calling webservice using ajax but it is saying webserice not defined .which otherwise works fineits work fine when rediect page in page_load instead .but i need to add function for https to http in every page. i still not know why ajax is not working when i use http module for redirect
We are using the Facebook API and receive back URLs for profile image thumbnails. Unfortunately the protocol is restricted to just HTTP and it doesn't support HTTPS. The page on our site that hosts the thumbnails is always delivered via HTTPS, and if we use HTTP for the thumbnails the user will receive security warnings from their browser.
Build an HTTP Handler that "passes through" the image from the Facebook URL, but allow the handler to be called via HTTPS. Before I started coding I thought I could something like this:
but I ended up having to save the image to an object in memory than write the image to the Response.OutputStream using the image save function.
This seems inefficient but I can't find a way of using the HTTP Handler as I orginally intended. Is there way of accomplishing the goal without creating the image memory and just "passing through" the call?
I plan to use output cache for my page and also specify sql dependencyi succeded in doing it the following way
Suppose if i want to implement a dependency on the sql query , i create an sqlcache dependency object and specify the sql command to it.Set the notifications .But how do i add this sqldependency to the output cache?For example: if i need to add a file dependency, i give something like Response.AddFileDependency ("filepath"); is there any similiar command available for sqldependency as well? I'm confused about this because, most of the examples i've looked into, does a cache.insert , which defeats my purpose as it's object caching and not output caching. In a nutshell, is it possible to attach a sqlcachedependency to o/p cache inside the controller action
I have a user control (say PricingGrid.ascx) which generates a pricing grid on a given product's page. I pass the user control 2 parameters : currencyId and productId. The user control has output caching specified by
I am adding PricingGrid.ascx to my page programatically, i.e. using LoadControl [URL]If the user changes their currency and refreshes the page, the cached version of their original currency is still showing, until the 60 seconds expires. Is there any way to force the page to check :1) Does a cached version of PricingGrid.ascx with their new currency exist?2) If so, retrieve that version, and if not, create that version.If I output all the keys in the Page.Cache object on PageLoad, I'm not seeing my user control in the output.
I've seen a number of options for adding GZIP/DEFLATE compression to ASP.Net MVC output, but they all seem to apply the compression on-the-fly.. thus do not take advange of caching the compressed content.
Any solutions for enabling caching of the compressed page output? Preferably in the code, so that the MVC code can check if the page has changed, and ship out the precompressed cached content if not.
This question really could apply to regular asp.net as well.
I have a page which contains a user control. The structure of the page is as shown below:
Incase your not able to see the above image, check it at [URL] Now, apart from the contents of the UserControl, I'd like to cache the entire page. I tried using the OutputCache attribute in the .aspx page, however it caches the contents of the UserControl as well.
I would like to use output caching with WCF Data Services and although there's nothing specifically built in to support caching, there is an OnStartProcessingRequest method that allows me to hook in and set the cacheability of the request using normal ASP.NET mechanisms.
But I am worried about the worker process getting recycled due to excessive memory consumption if large responses are cached. Is there a way to specify an upper limit for the ASP.NET output cache so that if this limit is exceeded, items in the cache will be discarded?
I've seen the caching configuration settings but I get the impression from the documentation that this is for explicit caching via the Cache object since there is a separate outputCacheSettings which has no memory-related attributes.
Here's a code snippet from Scott Hanselman's post that shows how I'm setting the cacheability of the request.
I have a need to run an application in classic mode for backwards compatibility with a specific application, and am trying to understand what kind of impact that will have on the performance of an MVC application that is running on the site. If we put a few static file maps (for .js, .css, .png, etc) above the ASP.NET wildcard map to reduce the amount of processing by the ASP.NET handler, will we be approaching the integrated mode in terms of performance?
The thing i'm primarily concerned with is any effect this might have on output caching. I understand that integrated mode might (?) allow for the output cache to handle non ASP.NET content, but that isn't really a concern. We're more interested in ensuring that the MVC application has full use of the output cache. Empirically i've found that the two configurations operate on par when things go well, but if the page references resources that are not available, the integrated mode tends to fail much more quickly than the classic mode (e.g. 500 ms vs 10 seconds), reducing 'hang time' on the page load.
i have a custom handler which captures user's book mark entry. To debug this handler, i have created a file "test1.txt" in code behind which saves the user entry. After the debug, i removed the text file (test1.txt) then re-complied the web app and deployed new DLLs for the site. But, the site is still looking for test1.txt file. i dont know how to confirm if the handler is really removed from the new DLL. Also, looked at the handler code behind file and didn't find any entry with test1.txt. So,
I have some code that is used to replace certain page output with other text. The way I accomplish this is by setting the Response.Filter to a Stream, Flushing the Response, and then reading that Stream back into a string. From there I can manipulate the string and output the resulting code. You can see the basic code for this over at [URL] However, I noticed that Page Caching no longer works after the first Response.Flush call.
I put together a simple ASP.NET WebApp as an example. I have a Default.aspx with an @OutputCache set for 30 seconds. All this does is output DateTime.Now.ToLongTimeString(). I override Render. If I do a Response.Flush (even after the base.Render) the page does not get cached. This is regardless of any programmatic cacheability that I set. So it seems that Response.Flush completely undermines any page caching in use. Why is this?
extra credit: is there a way to accomplish what I want (render output to a string) that will not result in Page Cache getting bypassed?
To my surprise, things went horribly wrong. The custom http handler intercepts this, but since it's designed to just load files from the file system, it doesn't work. I realize that, technically, it matches a pattern *.css but that seems an odd behaviour, since the actual resource being requested from the web server is *.ashx and the css is only after the file path, as a parameter.
Is it possible to make the filter for a handler only apply to the actual server resource name?
Alternatively (and actually I'd like to know how to do this anyway) -- what I would really rather be doing is intercepting the output from the default css handler. That is, rather than having all my own code to actually load files from the file system in my CSS handler, it seems it would be far simpler to just take the response from the default handler and filter it. Which would have worked properly in this situation.
Finally, in either case, I'd much rather be filtering on resource MIME type text/css rather than intercepting requests by name, since what I really want to do is filter any CSS (rather than anything that happens to be named "*.css"). how to do this?
I have an ASP.Net site (happens to be MVC, but that's not relevant here) with a few pages I'd like cached really well.
Specifically I'd like to achieve:
output cached on the server for 2 hours.if the file content on the server changes, that output cache should be flushed for that page cached in the browser for 10 minutes (i.e. don't even ask the server if it's that fresh)when the browser does make an actual subsequent request, I'd like it to use etags, so that the server can return a 304 if not modified.
(note - time values above are indicative examples only) 1) and 2) I can achieve by Response.Cache.SetCacheability(HttpCacheability.Server) I know 3) can be achieved by using max-age and cache-control:private I can emit etags with Response.Cache.SetETagFromFileDependencies();
but I can't seem to get all of these things to work together. Here's what I have:
can browsers do both 3) and 4) like that? When Firefox issues a new request after it expires in the local cache, it does indeed send the etag the server responded with before, but I get a 200 response.setting the variables like above, where would I set the duration of the output caching?
now when I type the URL http://mysite/processTask in browser I get HTTP 404 but if I change the add verb line to the following one:
<add verb="GET" path="processTask.asmx*" type="MyHandler.ProcessTaskHandler, MyHandler"/> and type http://mysite/ProcessTask.asmx in browser the handler is run and I get the response from the handler. What's the problem? Why is the handler run only when the path contains .asmx? How do I change web.config so that .asmx is not required?
I've created a class library project and this has a class implementing the IHttpHandler interface. Let's call this class ZipHandler. Let's say the namespace is Zip. I want that whenever any Http request comes for a zip file, my ZipHandler should handle it, regardless of whether the request is to an Asp.Net application or a normal virtual directory.
Is it possible (it should be given the hype about integrated pipeline etc. in IIS 7)? How to do it?