ashx

ASP.NET - Passing JSON from jQuery to ASHX

戏子无情 提交于 2019-11-26 23:58:35
I'm trying to pass JSON from jQuery to a .ASHX file. Example of the jQuery below: $.ajax({ type: "POST", url: "/test.ashx", data: "{'file':'dave', 'type':'ward'}", contentType: "application/json; charset=utf-8", dataType: "json", }); How do I retrieve the JSON data in my .ASHX file? I have the method: public void ProcessRequest(HttpContext context) but I can't find the JSON values in the request. Claudio Redi I know this is too old, but just for the record I'd like to add my 5 cents You can read the JSON object on the server with this string json = new StreamReader(context.Request.InputStream)

Display Image using ashx Handler

痞子三分冷 提交于 2019-11-26 17:51:32
问题 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)

file download by calling .ashx page

我是研究僧i 提交于 2019-11-26 16:55:23
问题 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

How to use output caching on .ashx handler

情到浓时终转凉″ 提交于 2019-11-26 15:35:52
问题 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? 回答1: 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

.aspx vs .ashx MAIN difference

試著忘記壹切 提交于 2019-11-26 15:12:02
问题 What are the differences between .aspx and .ashx pages? I use ashx now when I need to handle a request that was called from code and returned with a response, but I would like a more technical answer please. 回答1: Page is a special case handler. Generic Web handler ( *.ashx , extension based processor) is the default HTTP handler for all Web handlers that do not have a UI and that include the @WebHandler directive. ASP.NET page handler ( *.aspx ) is the default HTTP handler for all ASP.NET

jQuery ajax post to web service

二次信任 提交于 2019-11-26 14:47:34
问题 $(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. 回答1: dataType should be the type of what you

ASP.NET - Passing JSON from jQuery to ASHX

僤鯓⒐⒋嵵緔 提交于 2019-11-26 08:49:25
问题 I\'m trying to pass JSON from jQuery to a .ASHX file. Example of the jQuery below: $.ajax({ type: \"POST\", url: \"/test.ashx\", data: \"{\'file\':\'dave\', \'type\':\'ward\'}\", contentType: \"application/json; charset=utf-8\", dataType: \"json\", }); How do I retrieve the JSON data in my .ASHX file? I have the method: public void ProcessRequest(HttpContext context) but I can\'t find the JSON values in the request. 回答1: I know this is too old, but just for the record I'd like to add my 5

How to implement multiple searching in jqGrid

折月煮酒 提交于 2019-11-26 02:14:52
问题 I have a jqGrid which I am using with asp.Net Web Forms , it shows the required information properly from the database , however it shows the search option as well but if I try to search lets say First Name that is Equal to Lijo , it just does not show up that record.The record exists.I know I am missing some stuff required for searching surely , here is the code <script type=\"text/javascript\"> $(function() { $(\"#UsersGrid\").jqGrid({ url: \'ModCust.ashx\', datatype: \'json\', height: 250,