ashx

send json array to ashx handler

六月ゝ 毕业季﹏ 提交于 2019-12-10 12:08:43
问题 I have this code, and when i'm executing it this keeps showing the same error: Invalid JSON primitive: titles. Client Side: var title = new Array(); ... for (var i = 0; i < names.length; ++i) { title[i] = '{ "titulo' + i + ':"' + names[i] + '"}'; } $("#gif").show(); $.ajax({ async: true, contentType: 'application/json; charset=utf-8', dataType: 'json', type: "POST", data: { titles: title }, url: "../handlers/saveUpload.ashx", success: function (msg) { $("#gif").hide(); } }); Server Side:

ASP.NET VB KML Generator

痴心易碎 提交于 2019-12-09 19:33:27
问题 Here is a handler (ashx) file that generates KMZ files (can generate KML by not using the Ionic compression classes (Ionic = DotNetZip at Codeplex). This handler uses an SQL table to populate the place marks but is a good example of ashx handler use, custom icon use, properly compressing the file, and populating place marks. By using context.Response.OutputStream, this is very efficient within the .NET engine. <%@ WebHandler Language="VB" Class="YourKML" %> Imports System Imports System.Web

How can I apply GA download tracking with Sitecore?

和自甴很熟 提交于 2019-12-08 09:19:21
问题 I'm posting this question to Stackflow b/c after doing much research into an answer to this very question online, I did not come across a straight forward answer and had to do my own sleuthwork to resolve this. Basically, Sitecore uses a handler file .ASHX for all files uploaded to the Media Library. Since the 3rd party GA tracking tool I was using (entourage.js or gatags.js) does not recognize .ashx as a whitelisted download file, it was not adding the appropriate GA tracking syntax to the

Use ASP.Net server control code generation from .ashx

余生颓废 提交于 2019-12-08 03:36:42
问题 I'm trying to take an existing bunch of code that was previously on a full .aspx page, and do the same stuff in a .ashx handler. The code created an HtmlTable object, added rows and cells to those rows, then added that html table the .aspx's controls collection, then added it to a div that was already on the page. I am trying to keep the code in tact but instead of putting the control into a div, actually generate the html and I'll return that in a big chunk of text that can be called via

$.get, $.post, $.ajax, $(elm).load to .ashx page problem

浪尽此生 提交于 2019-12-08 02:32:15
问题 HTML page // in script tag $(document).ready(function () { var url = "list.ashx"; $.get(url + "?get", function (r1) { alert("get: " + r1); }); $.post(url + "?post", function (r2) { alert("post: " + r2); }); $.ajax(url + "?ajax", function (r3) { alert("ajax: " + r3); }); $("div:last").load(url + "?load", function (r4) { alert("load: " + r4); }); }); // in body tag <div></div> in 'list.ashx' public void ProcessRequest (HttpContext context) { context.Response.Write("ok"); } the result $.get and

ASP.NET - Display Images and pdf in a GridView

与世无争的帅哥 提交于 2019-12-08 00:38:59
问题 I want to display in an asp:GridView an "Images" column. The idea is to provide a thumbnails of the image with link to real size image. For some rows, this may alternatively be a PDF document. I'd like the link to be to the PDF. The PDF or image are stored in a SQL database. Now I have error in Handler (.ashx) file: "Invalid attempt to read when no data is present." This is my code : ASP: <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID=

How do I use an .ashx handler with an asp:Image object?

独自空忆成欢 提交于 2019-12-07 17:50:45
问题 I have an ashx handler: <%@ WebHandler Language="C#" Class="Thumbnail" %> using System; using System.Web; public class Thumbnail : IHttpHandler { public void ProcessRequest(HttpContext context) { string imagePath = context.Request.QueryString["image"]; // split the string on periods and read the last element, this is to ensure we have // the right ContentType if the file is named something like "image1.jpg.png" string[] imageArray = imagePath.Split('.'); if (imageArray.Length <= 1) { throw

Multiple image handler calls causing IE to hang in pop-up window

北城余情 提交于 2019-12-07 05:45:16
问题 We have an ashx image handler which has performed fairly well over the last few years, but we've recently noticed some odd intermittent behaviour in IE8 and IE9 . We have a gallery page which calls the image handler multiple times as part of an image's src attribute, this page is opened in a pop up window. The page works fine when but when the window is opened and closed in quick succession (before all the images on the page have finished loading) it causes the browser to hang and

asp.net ashx request 404

我是研究僧i 提交于 2019-12-07 05:17:26
问题 I am using an ashx request handler to retrieve images and my breakpoint in the ashx file isn't being hit. When I use firebug I can see that the request is returning a 404 which makes me think that I need to configure some setting so that ashx file can be found. I am using visual studio 2008 and .net 3.5. ASHX file namespace hybrid.content.Handlers { public class DB_Images : IHttpHandler { public void ProcessRequest(HttpContext context) { Int32 image_id; if (context.Request.QueryString["id"] !

$.get, $.post, $.ajax, $(elm).load to .ashx page problem

混江龙づ霸主 提交于 2019-12-06 05:57:40
HTML page // in script tag $(document).ready(function () { var url = "list.ashx"; $.get(url + "?get", function (r1) { alert("get: " + r1); }); $.post(url + "?post", function (r2) { alert("post: " + r2); }); $.ajax(url + "?ajax", function (r3) { alert("ajax: " + r3); }); $("div:last").load(url + "?load", function (r4) { alert("load: " + r4); }); }); // in body tag <div></div> in 'list.ashx' public void ProcessRequest (HttpContext context) { context.Response.Write("ok"); } the result $.get and $.post reach list.ashx but no return $.ajax not reach list.ashx $.load fully success The problems are