ashx

ASP.NET server-side cache lifetime?

I have written a small ASHX handler that uses a small state object that I'd like to persist through the lifetime of a series of requests. I have the handler putting the object in the server-side cache (HttpContext.Current.Cache) and retrieving it at the start of ProcessRequest. How long can I expect that object to remain in the cache? ...

Track Hits using Google Analytics and an ASP.NET web handler (ASHX) page.

We are using Google Analytics for our site, but since it uses client script in HTML output we are unable to track hits to any of our ASP.NET ASHX handler pages. Does anyone know of a way to do this? ...

ASHX image handler works with chrome, not IE8

I've created code to retrieve an image from the file system using an ASHX handler. The code displays the image correctly in Chrome, but I get a broken image in IE: public class ImageHandler : IHttpHandler { private int? QS_ImageID { get { int? temp = null; if (HttpContext.Current.Reques...

json call and forms authentication time out

I am making a ASHX handler call to get JSON object. How do I handle or redirect user to login page if forms authentication times out when calling ashx handler page? ...

How do I access jQuery AutoComplete extraParams with ASP.NET

I'm using the following jQuery script to send a 'Make' parameter to filter my 'Models': $(document).ready(function () { $(".autocomplete_make").autocomplete("/AutoComplete/Make.ashx"); }); $(document).ready (function () { $(".autocomplete_model").autocomplete("/AutoComplete/Model.ashx" ...

ASP.NET Call ashx, and refresh parent page to show latest details

In the button "Export to XML" i am calling a "DownloadXML.ashx" After which, i would like to refresh the page to show the latest status as "Exported" I have tried to (1) RefreshDetails then call the ashx (2) Redirect to the current page then call the ashx But it all doesn't seem to work. Any help plz??? for (1) the button click aft...

How to access localised resources in an .ashx file?

I have an ashx file which returns a localised message. This is called from an Ajax request. I need to access the Asp.net ResourceManager in the ashx file. ...

document.write in StringBuilder?

I am using a StringBuilder in an ashx file to return javascript. It all works fine, except for one line... javascript.Append("document.write(\"<script id=__ie_onload defer \" + \"src=javascript:void(0)><\/script>\");"); For readability, here is the unescaped version: document.write("<script id=__ie_onload defer src=javascript:void(0...

Sitecore Images (ASHX extensions) not being picked up by IIS 5.1 or IIS7 Express- Getting 404 Instead

At the moment I have no images being picked up at the moment, and this is off a completely default Sitecore Xpress install. I think this version is based on a 6.0 release I have installed it on a XP machine (no images) and then tried running it through WebMatrix, still with no images. I am at a loss really, and I have been grasping ...

Update Image based on Response Stream

Is is possible to update an image on an HTML page using the response stream of an ASP.NET Generic Handler? For example, if I have the following code on a handler: // http://www.example.com/?Guid=&lt;AccountGuid&gt; public void ProcessRequest (HttpContext context) { context.Response.ContentType = "image/png"; context.Response.W...

.NET image handler stripping filetype on download

I have created an ashx handler to render image thumbnails from images in a mysql database. If a file name is passed through querystring, the content disposition filename is set (when user clicks "save as..." the filename appears). The images appear properly and the filename appears when user selects "save as..." but the filetype is lis...

Running cscript.exe from C# .ashx does not execute code in vbscript file

EDIT I added in some error handling to my .vbs file and it is indeed a permissions issue (I now get a "Permission Denied error"). However, supplying my credentials in the web.config <impersonate> tag does not seem to have any effect. Also when trying to supply my credentials to the process via via p.StartInfo.Password = Misc.CreateSe...

Can web forms and generic handlers (ashx files) share a common ancestor class (or base page)?

If one has an ASP.net web site whose web forms all inherit from a common base page--which checks things like authentication and redirects when a session has expired, etc--is there a way to use this base class in a ashx handler? I started going down that road by inheriting the base page class in the handler and realized this might not be ...

Handler with IRequiresSessionState does not extend session timeout

I have a handler, like this, using IRequiresSessionState: public class MyHandler : IHttpHandler, IRequiresSessionState { // code } In the code, I am able to read and set Session values. I also check ensure that the caller is logged in. That all works fine. The web site uses forms authentication, so in the web.config, I have this: ...

I need to create an ashx httphandler to display images from SQL Server 2008 using SQL FILESTREAM

Hi Guys, I'm trying to create an ashx httphandler to display images from SQL Server 2008 using SQL FILESTREAM. Does anyone have an example of the web.config setting and ashx code needed to do this? Thanks! Richard. ...

In an ashx file, can I set the filename of the returned file?

My ashx response.writes a simple text file that is returned. Can I change the filename, so if my ashx is located at mysite.com/someURL it doesn't return someURL.txt but rather, myFileName.txt ? ...

ASHX C# for each loop on POST vars

Hello. I have the following piece of code on C#, on an ASHX or Generic Handler file: public override void ProcessRequest(HttpContext contexto) { string destino = contexto.Request["destino"]; string variables = "?"; string valor = ""; foreach (string nombre in contexto.Request.QueryString) { if (nombre == ...

How to serve files and html directly from a WCF-service similar to an ASHX-handler?

Im writing an install and update-server for an intranet-application and I want the user to be able to install the app directly from a url such as: http://domain.local/myapp/install.exe where this request is handled by my service. I also would like to be able to serve some basic HTML on for instance http://domain.local/myapp/status.html ...

jQuery autocomplete: change SQL query depending on selected checkbox

Hi, imagine i have one textbox (with autocomplete 1.1, not the latest UI version) and a checkbox. The textbox triggers an asp.net .ashx page that will execute a stored procedure at the sql-server and return the results. It's all working, but i want to add another feature. When the checkbox is checked i want stored_procedure_1 to be exe...

How to register HttpHandlers in IIS 7.0 integrated mode using .ashx files

According to documents it's clear how to register HttpHandlers in IIS 7.0 integrated mode if you implement IHttpHandler inside a dll and put it in Bin folder of web application. Then adding a line in web.config of that application completes the registeration process. There is an .ASHX file type which implements IHttpHandler by default. S...