I have an IHttpHandler that I would like to hook into the OutputCache support so I can offload cached data to the IIS kernel. I know MVC must do this somehow, I found this in OutputCacheAttribute:
public override void OnResultExecuting(ResultExecutingContext filterContext) {
if (filterContext == null) {
throw new ArgumentNullException("filterContext");
}
Actually the handler never gets called. I already searched the forums and tried some tips and hints. But nothing of that worked. Try to call the url via[URL]
I made a custom handler that derives from MvcHandler. I have my routes using a custom RouteHandler that returns my new handler for GetHttpHandler(), and I override ProcessRequest() in my custom handler. The call to GetHttpHandler is triggering a breakpoint and my handler's constructor is definitely being called, but BeginProcessRequest() is being called on the base MvcHandler instead of ProcessRequest().
Why are the async methods being called when I haven't done anything to call them? I don't want asynchronous handling, and I certainly didn't do anything explicit to get it. My controllers all derive from Controller, not AsyncController.
I don't have the source code with me right now, but I can add it later if needed. I was hoping someone might know some of the reasons why BeginProcessRequest might be called when it's not wanted.
I am trying to add page with custom extension, say .asp2 with my set of html tags.Now whenever i try to access the page on browser...it asks me "Save as". This happens because I am using an extn which the server is not able to recognise.What should I do to so that my server, IIS 5.1 recognises this extension??
how to associate custom events on such custom page?
I am trying to implement an IHttpHandler. I have defined an appropriate class but the debug web server (you know, the one you get if you hit f5 in Visual Studio) is responding with "Can't Display Page".I looked here http://msdn.microsoft.com/en-us/library/ms228090%28v=VS.90%29.aspx to learn how to configure the handler, and it seems there are different ways for IIS6 and 7. But the process is put something in the web.config and then set it up in IIS Manager. However, that is a deployment issue. I want to be able to run it in the test server, and I don't know how to do this second step in the test server.I put the following in my web.config:
<httpHandlers> <add verb="*" path="*.sample" type="MyNamespace.Code.HelloWorldHandler"/> </httpHandlers> HelloWorldHandler is the code from the link above (wrapped in MyNamespace.)
Can someone let me know how to configure this correctly for the development server?
I'm working on a reporting script which runs a number of reports (pdf) on button click. The reports are created on the web server then I'd like the user to be given the option to download the files. I have worked out the script for downloading one file from the server. But I'm not sure how to download multiple files? (there will probably be about 50)
After I run one report I redirect the user to a http handler script.
Response.Redirect("Download.ashx?ReportName=" + "WeeklySummary.pdf"); public class Download : IHttpHandler { public void ProcessRequest(HttpContext context) {
I have a IHttpHandler that acts as a source to a jQuery Autocomplete input field. In the constructor of the handler I generate an index that remains fairly static between request (needs to be rebuilt maybe once a day).How can I cache the the index between calls? Debugging indicates that the constructor is called for each request. I've set IsReusable to "false".
I want to create an HTTP handler within my project. To do this, I created a new class, and tried to implement IHttpHandler.
Each time I do this, I get the error 'End of statement expected'.
I know that normally you can create a new class library and create a class to implement a handler. But why is it not possible to do this in an existing web project?
I have an IHttpHandler that implements IRequiresSessionState. Everything works fine on most servers but there are 2 servers (one IIS 7.0 and one IIS 7.5) that give me null sessions. Aspx pages are fine on every server. I've searched for hours and failed to find anything that is not related to IRequiresSessionState.
I am trying to create url routing like this[URL] but I am having few questions , first why he is adding lines to the web.config , I tested it and it didnt appear that they're doing something as I commented them and nothing major appeared second I am having this line of code that is crashing var display = BuildManager.CreateInstanceFromVirtualPath(_virtualPath,typeof(Page)) as IProfileHandler;
when casted as ihttphandler it's working , but when I am casting it to iprofilehandler(which is implemeting ihttphandler) it's giving null !
First, I'm looking for a a small example of how to handle a series of RESTful URLs, such as /Account/{userName} and /Account/{userName}/Profile with a single HttpHandler. At this time, I'm not interested in embracing MVC or using the REST Starter Kit. Should I place the HttpHandler class in a Class Library? Should I publish to the root of the RESTful URL?
My second issue stems from the fact that my ASP.NET hosting is done through a web-hosting company. Will I need to ask their tech team to configure IIS for me? Is that normal practice?
I want to implement a restful service in ASP.NET. I want it to be compatible with .Net 2.0 and IIS 5+. I am constrained to not use ASP.NET MVC or REST starter kit. By reading on internet I have learned that it can be implemented using HTTPHandlers. The problem is, the request will come in as a POST request. And I want to URL to be like:
http://abc.com/MyService/MyMethod1/ and http://abc.com/MyService/MyMethod2/
I created an application and implemented IHTTPHandler for all incoming request ending with ".aspx" extension.Under "ProcessRequest" module, I am creating an instance of HttpContext (with URL attributes different from my application's URL i.e. if I am working on localhost then speciying Yahoo.com as its URL) and assigning it to "context" which comes as method argument.After redirection, an error is generated. Also, the custom HTTPContext is not passed to the requested page (default.aspx, in my case.)Code is as follows.
I've got a problem using outputcache together with urlrewriting. We've got an application that rewrites url (IE [URL]). Based on the URL (/about/) we figure out which content to show. Now we're trying to add outputcache to that page:
However, when we publish the page i'd like to invalidate the cache so that the editors see the change directly. But no matter what I try, I cannot seem to invalidate the cache. If I'd like to invalidate "/about/" I would like to do this: HttpResponse.RemoveOutputCacheItem("/about/"); That doesn't work unfortunately. The only thing that seems to work is: HttpResponse.RemoveOutputCacheItem("/page.aspx");
This clears the cache for all my pages, not just "/about/". Is there any way to invalidate the cache based on the url? Or should we provide a cache key or something per page to be able to invalidate the cache programmatically?
I read many posts about outputcaching element in asp .net MVC, but i have one question.My architecture is :1 master page, 1 page (especially news information), and a few other controls like LogOnUser / Fixed status bar etc...I want to have my news cached cause there are three query to entities, but i need too the title for SEO of my master page (title is included in a contentplaceholder in master).I tried to use renderaction outputcache but it is not possible to retrieve the title from the renderaction. Have you any idea about this problem ?Maybe it's preferable to use a general outputcache and use a substitute from dynamic data, but i don't know if it's a best practice or not.
i've got a website that uses OutputCache attribute to cache pages. Works great.
Now, I'm in the middle of R&D'ing scaling up this site to be in a web farm. Along with the usual suspects for webfarm pain ... I've noticed (pretty quickly/obviously) that the OutputCache from Server_A doesn't invalidate the OutputCache from Server_B .. if a try and invalidate a single server's OutputCache. This makes total sense -> how can S_A 'tell' S_B to invalidate when they are physically 2 seperate machines, etc?
So - what are our options?
Velocity? I understand this will move the caching to a different layer .. which means that the final result (output) will always be required to be determined .. as opposed to the OutputCache whic remembers the final output content (yes, varby gives different versions, etc.. which is totally fine). So even though the poco or business objects are all sync'd, there's still that last rendering effort required (even if it's tiny .. compared to the effort to generate/sync business objects).
i have CMS that dynamically add user control to page. now i wanna use OutputCache for user control and set it from server side code. how i can do that?
I've an action in a controller that returns different content if the request is Ajax or not:
[Code]....
So, from the view I can fill a <div> with the PartialView (RenderPartial), calling the same action (allowing javascript disabled clients). The problem is the cache, because when the request has cached as a normal request, if later sends the request as an Ajax request, the view is rendered very bad.
The question is: Is there any way to use OutputCache to allow to cache in different entries this two types of requests (Ajax and not Ajax).
I have a user control with OutputCache set to vary by any param (*). This user control has a LinkButton, which when clicked, causes a postback, and displays a ModalPopupExtender (the extender's TargetControlID is a dummy link). The user control is included on an aspx page.
The LinkButton is displaying the popup just fine. But if I open another browser tab/window/type, the LinkButton fails to generate the popup. I've tried (all separately):
moving the popup extender and its associated control to the main aspx page use OutputCache Location="None" on main page dynamically create the Popup extender and its associated control in Page_Init of both ascx and aspx
I'm looking into using the OutputCache-attribute for my ASP.NET MVC website. However, my website is using resources (*.res-files) to display two different languages (based on the user's settings in a cookie and/or database setting). Is there any way I can cache actions for my two languages separately?
Setting a "VaryByHeader" isn't gonna cut it since I have lots of visitors so every second visitor has probably another language set than the visitor before him. This would cause the cached action/page to always be updated since it's a different language.
I am using MVC 2 and am having problems getting the OutputCache to work. My ASP.NET website has Several Views and a View Master Page. On my View Master Page I have a Menu on the left hand side displaying navigation links (implemented using JQuery).
I have implemented the Menu as a PartialView and I call this PartialView from my MasterPage using Html.RenderAction. This all works fine, my controller fetches the data from the database and the PartialView is populated.
The problem is I want to cache the Menu data since it's consistent on all pages. Yet when I add the OutputCache parameter to my Action it has no effect.
I'm using routing from System.Web.Routing without MVC in a standard ASP.Net Web Application Project application. This is mostly done to get neater urls in the portal we are developing (instead of ~/default.aspx?contentid=123 we have ~/{contentsubject}. The portal is not authorized and all info is in the url so in a caching scenario we can cache complete pages.
When I tried to enable output caching I noticed that no caching was done. It seems that the outputcache page directive is completely ignored. Is this true or am I missing something? Can this be fixed?
I made a small test app (I uploaded it to [URL] that just contains a page, Webform1.aspx, that uses a master page and a user control. All three output the current date and time.
When I request http//localhost/OutputcacheTest/Webform1.aspx the 10 second caching works as expected, i.e. the shown time only updates every 10 seconds.
The app also defines a wildcard route that catches all requests and returns the same Webform1.aspx as a handler. So when requesting http//localhost/OutputcacheTest/myroute the same page is executed but now the caching doesn't work, i.e. the current time is shown on every request.
Note: When using the built-in development web server both scenarios work, only IIS seems to have this problem.
Does anyone have a a solution or work around for how to enable output caching in this scenario?