ashx

PDF Handler : content-disposition filename

你。 提交于 2019-11-28 07:34:01
I am outputting a PDF file in a Web browser (IE8) HttpContext.Response.writefile(fileName) and it works great. When I try to save the file, it will give me the name of the ashx handler as a default. I would like to actually pass the real name. I tried to add header information as follow: context.Response.AddHeader("content-disposition", "attachment; filename=" + fileInfo.Name); And it works but I do not want the user to have to choose between open and save, i want the file to open normally and if the user chooses to save it then the dialog would give him/her the default filename. I tried also:

response redirect from .ashx file

萝らか妹 提交于 2019-11-28 02:48:03
问题 I have ashx file and I want to redirect from ashx to aspx page. Some solution? 回答1: void ProcessRequest(HttpContext context) { context.Response.Redirect(newUrl); } 回答2: Using context.Response.Redirect(newUrl); results in a page that says: "Object moved to here." Update: This happened because I signed out, in that case the answer is to use FormsAuthentication.RedirectToLoginPage(); 回答3: I found a solution and it should work fine: context.Response.ContentType = "text/plain"; if (controlcase) {

What are the benefits of an ASHX handler file in asp.net?

我怕爱的太早我们不能终老 提交于 2019-11-27 16:02:35
问题 What are the benefits of using an ashx, or handler? Also, do I need them if I use MVC (and why not)? Does the framework matter (2.0+)? Why would I want to use a handler? I was recently recommended to use one for retrieving an image but I don't know why. Thank you for your time. Edit - is a handler faster? 回答1: Just a few examples: Dynamic image generation : You can write handlers that return data driven images by creating an ASHX handler that returns image data and then using that URL in your

file download by calling .ashx page

故事扮演 提交于 2019-11-27 14:48:56
I'm requesting .ashx page from Master page client side script (Jquery) which has a code to download a PDF file. When I debug it, I can see the execution of "file download" code but file is not downloading. $.ajax({ type: "POST", url: "FileDownload.ashx", dataType: "html", success: function (data) { } } ); public class FileDownload : IHttpHandler { public void ProcessRequest(HttpContext context) { //context.Response.ContentType = "text/plain"; //context.Response.Write("Hello World"); string fileName = "BUSProjectCard.pdf"; string filePath = context.Server.MapPath("~/Print/"); context.Response

Supporting resumable HTTP-downloads through an ASHX handler?

爷,独闯天下 提交于 2019-11-27 12:31:05
We are providing downloads of our application setups through an ASHX handler in ASP.NET. A customer told us he uses some third party download manager application and that our way of providing the files currently does not support the "resume" feature of his download manager application. My questions are: What are the basic ideas behind resuming a download? Is there a certain HTTP GET request that tells me the offset to start at? Resuming a download usually works through the HTTP Range header. For example, if a client wants only the second kilobyte of a file, it might send the header Range:

How to use output caching on .ashx handler

寵の児 提交于 2019-11-27 11:29:17
How can I use output caching with a .ashx handler? In this case I'm doing some heavy image processing and would like the handler to be cached for a minute or so. Also, does anyone have any recommendations on how to prevent dogpiling? There are some good sources but you want to cache you processing server side and client-side. Adding HTTP headers should help in the client side caching here are some Response headers to get started on.. You can spend hours tweaking them until you get the desired performance //Adds document content type context.Response.ContentType = currentDocument.MimeType;

jQuery ajax post to web service

Deadly 提交于 2019-11-27 09:31:33
$(document).ready(function() { $.ajax({ type: "POST", url: "/getprojects.ashx", data: "<formData client=\"\" year=\"\" categories=\"\" tags=\"\" freeText=\"\" count=\"34\" page=\"1\"></formData>", dataType: "text/xml", cache: false, error: function() { alert("No data found."); }, success: function(xml) { alert("it works"); alert($(xml).find("project")[0].attr("id")); } }); }); My problem is i get some data back but i can't seem to get it displayed. dataType should be the type of what you receive but contentType should be the mime-type of what you are sending, the following should be ok: $

Display Image using ashx Handler

孤街醉人 提交于 2019-11-27 09:29:57
I have the following image in my aspx page <td> <asp:Image ID="LargeImage" runat="server" Height="100" Width="100" />" </td> In my aspx.cs, assigned a imageurl to this image protected void uploadimage_Click(object sender, System.EventArgs e) { ImageUtils.uploadImage(Titletxt.Text, FileUpload.FileContent); LargeImage.ImageUrl = "~/AvatarImageFetch.ashx?memberid=" + memberid.ToString(); } For some reason, the image doesn't show up. Here's my ashx public void ProcessRequest(HttpContext context) { SqlConnection myConnection = new SqlConnection(System.Configuration.ConfigurationManager

ASP.NET [Image Handler]

早过忘川 提交于 2019-11-27 08:35:20
问题 I'm still trying to load my image from database. But that's not so easy with my skins to understand the shots : Using Handler I read this stuff and was on trying to make it but I found only one method : Mapping some my page (in webconf) to this handler (ashx) I need to use it in my page in my and Thank you. 回答1: it's pretty straight forward and has been answered before. Dynamically Rendering asp:Image from BLOB entry in ASP.NET where most novices get confused is that the image data is never

PDF Handler : content-disposition filename

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 01:58:04
问题 I am outputting a PDF file in a Web browser (IE8) HttpContext.Response.writefile(fileName) and it works great. When I try to save the file, it will give me the name of the ashx handler as a default. I would like to actually pass the real name. I tried to add header information as follow: context.Response.AddHeader("content-disposition", "attachment; filename=" + fileInfo.Name); And it works but I do not want the user to have to choose between open and save, i want the file to open normally