ashx

Execute some codes when closing an Asp.net page

吃可爱长大的小学妹 提交于 2019-12-25 07:00:44
问题 I want to delete a row in a Database table when a user closes an .aspx page. How could I do it? I know how to delete a row in a Database table but I don't know how to do it when a user leaves an .aspx page? 回答1: You can bind an ajax call to the "beforeunload" page html event. Just make sure to call ajax with async false, otherwise the page will be close before the code to delete the row actually runs. I'm assuming you are using jQuery for the ajax call. For example, in html: <body

convert array to json and receive in ashx handler

柔情痞子 提交于 2019-12-25 04:42:49
问题 I've been trying a lot of possible solutions and none of them worked, i have something like this, but i don know if the json structure is correct, or i'am not sending it correctly to the server side, i'd like to know where is the source of the problem. This is the error: No parameterless constructor defined for type of 'System.String[]'. Client-Side function upload() { var title = []; var files = $('#myfile').prop("files"); var names = $.map(files, function (val) { return val.name; }); for

Jquery $.get call and $.ajax is not working for calling ASHX handler

ぃ、小莉子 提交于 2019-12-24 14:41:20
问题 I have a Asp Button as follow: <asp:Button ID="btnSubmit" runat="server" OnClientClick=" if (!ValidateForm()) return false;" PostBackUrl="https://some/website/dot/com" Class="btn_submit"/> In my JS, in the middle of ValidateForm() function I need to call a ASHX handler and do some stuff there. I am using this to call the ASHX file: $.get("../MasterPages/AHMHandler.ashx?test=1", function (r) { alert(r); }); But it is not working. Also I have tried $.ajax as follow and it always alerts error

Why is DNN killing my authentication cookies when I access an ashx from a child portal?

痞子三分冷 提交于 2019-12-22 08:16:46
问题 I am seeing a really wierd issue that only happens with non-administration users. When the user logs in and accesses one page, they are logged out of the system. The page finishes loading as if they were logged in, but once they try any other actions (including refreshing the browser page) they are considered not logged in and presented with a login prompt. Opening up fiddler, I can see one of the responses from the server contains the following: Response sent 71 bytes of Cookie data: Set

making asynchronous calls from generic handler (.ashx)

爱⌒轻易说出口 提交于 2019-12-22 03:44:55
问题 I have a form in my website which posts json to the async handler which validates the data and return back the resonse OK or error and i will make the redirect on the client based on the response give by my handler. But when the response is ok, i want to perform some tasks asynchronously. But the asynchronous calls are not working inside the .ashx code. it is always synchronous. Could you please give me an advice on this.? code: public class ValidateHandler : IHttpHandler,

How to properly use javascript deserialization to convert a json string to a complex object?

依然范特西╮ 提交于 2019-12-21 20:39:24
问题 I have the following json object that is available in my .ashx handler (var items=): {"Coverages":{"PersonID":10,"DetCode":"","Reimbursement":"","Deductible":"","MaximumPerAnnum":"","MaximumPerVisit":"","MaximumPerVisits":"","SvcCode":""},"CoverageCombinedMaximums":{"PersonID":10,"DetCode":["AAAAA","BBBBB","CCCCC"],"MaximumPerAnnum":""}} public void ProcessRequest (HttpContext context) { bool isSuccessful = true; var items = context.Request.Params["items"]; if (isSuccessful) {

ASHX handler with ASP.NET MVC 3 and Razor

岁酱吖の 提交于 2019-12-21 11:43:50
问题 I would like to use Silverlight Multi File Uploader with ASP.NET MVC 3. The problem is that I need to use ashx handler to handle file upload (the handler is part of the library). How can I integrate the handler with ASP.NET MVC 3 (I'm using Razor view engine) ? 回答1: My guess is that it is easier because it is part of a (older?) third party library and it easier to just follow the instructions that tells you to set something in web.config . You should be able to ignore requests to *.ashx by

How can I make a VERY simple web proxy using ASP.NET?

落花浮王杯 提交于 2019-12-21 05:00:57
问题 I'm about to launch a site that was working well until I found the following hiccup: I can't request a Yahoo! Pipe over SSL. So the pages that require SSL are now missing a piece of their functionality unless I figure out a way around this; obviously, this could be done if I use an SSL-hosted page on my app to request the Yahoo! pipe for me. I've seen solutions like http://www.iisproxy.net/license.html, but it seems to be a bit heavy for what I'm trying to do. Can't I do this with a simple

file upload using jquery ajax and asp.net handler

南楼画角 提交于 2019-12-20 23:50:13
问题 I am trying hard to get this working but i ma getting error while uploading file. ASPX <asp:FileUpload ID="FileUpload1" runat="server" CssClass="file-upload-dialog" /> <asp:Button runat="server" ID="btnUpload" CssClass="btn upload" Text="Upload" /> Handler public void ProcessRequest(HttpContext context) { context.Response.ContentType = "multipart/form-data"; context.Response.Expires = -1; try { HttpPostedFile postedFile = context.Request.Files["file"]; string savepath = HttpContext.Current

How to use Generic Handlers (ASHX) in ASP.NET MVC?

谁都会走 提交于 2019-12-20 08:43:32
问题 I need a image generator in my ASP.NET MVC application, but I don't know if it is possible to use ASHX in ASP.NET MVC. If there is an class similar to IHttpHandler that inherits IViewDataContainer, then I could use ViewData.Model on my ASHX. I read a blog post about it but it seem outdated from the info I got in the ASP.NET forum Any ideas? 回答1: You should just be able to return the image from the action? See here for more. And yes, you can use ashx alongside MVC (by telling it to ignore the