ashx

vb.net using ashx handler to get image from SQL Server

不打扰是莪最后的温柔 提交于 2019-12-20 06:29:16
问题 I have employee images stored in my EMPPhotos table on SQL Server 2008 R2 in an image datatype. I created a generic handler to get the image from the table and send it to the page. It does not work. I have tested the query itself and I am getting data. The handler: <%@ WebHandler Language="VB" Class="EmpImageHandler" %> Imports System Imports System.Web Imports System.Drawing Imports System.Drawing.Imaging Imports System.IO Imports System.Data Imports System.Data.SqlClient Public Class

Handler with IRequiresSessionState does not extend session timeout

江枫思渺然 提交于 2019-12-20 05:11:21
问题 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: <authentication mode="Forms"> <forms loginUrl="Login.aspx" timeout="10" slidingExpiration="true"></forms> </authentication> The problem is that AJAX calls from the

How to access localised resources in an .ashx file?

大城市里の小女人 提交于 2019-12-20 02:52:48
问题 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. 回答1: Following code worked for me. HttpContext.GetGlobalResourceObject("classKey", "resourceKey") as string; 回答2: Any resources in the app should be accessible under the Resources namespace. For a resource file called LocalMessages.en.resx: ReturnMsg = Resources.LocalMessages.MyAjaxMessage; For intellisense to work, make sure app has been

Downloading large files, saved in Database

China☆狼群 提交于 2019-12-19 10:42:00
问题 We have a lot of files, saved as binary in our SQL Server database. I have made an .ashx file, that delivers these files, to the users. Unfortunately, when the files become rather large, it will fail, with the following error: Overflow or underflow in the arithmetic operation I assume it runs out of memory, as I load the binary into a byte[]. So, my question is, how can I make this functionality, read in chunks (maybe?), when it is from a database table? It also seems like Response

ASP.NET MVC vs. Webforms vs. HTTP Handlers (.ashx) - which is the most lightweight? [closed]

浪尽此生 提交于 2019-12-18 13:35:35
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . I plan on building a simple, yet high usage webapp and need to settle on an architecture. basic server side logic / dynamic db driven content about half a dozen to a dozen pages serving up all said content no need for URL rewriting, pretty simple page flow/routing The

Supporting resumable HTTP-downloads through an ASHX handler?

守給你的承諾、 提交于 2019-12-17 10:42:50
问题 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? 回答1: Resuming a download usually works through the HTTP Range

how to get Physical path of working folder in javascript or jquery?

。_饼干妹妹 提交于 2019-12-13 21:26:32
问题 How to get Physical path of working folder in jscript or jquery? What i need is when a dropdown is selected or if a button is clicked i need to get complete path of the working folder. ex: var x="path" here x should be x=E:/projects/projectname/xyz.aspx. i dont want url of current docuent, i want complete path, so that i can generate new aspx page and place in that folder dynamically. 回答1: I think you are looking for something like this: var x = ('<%=HttpUtility.JavaScriptStringEncode(Server

How to: jQuery post to ashx file to force download of result?

让人想犯罪 __ 提交于 2019-12-13 19:06:12
问题 I have an ashx handler which takes the 'html' property from the request, then returns that back to whatever called it. I also have the Content-Disposition set as attachment. Calling the page directly works as expected, forcing a download with a save as dialog. What I'm stuck on is this: I need to do this from javascript (jQuery). I'll be posting the content of a div and do some further processing. Could someone give me some pointers on how this is done? Many thanks. 回答1: I would (in fact, do

Cache an object in a .ashx handler

时光毁灭记忆、已成空白 提交于 2019-12-13 08:25:18
问题 I'm not sure of the best way to approach this, but here is my scenario. Let's say I have an ashx handler that feeds out some data to an ajax request from the client. Something simple like: public class Handler : IHttpHandler { private List<MyObject> data; public bool IsReusable { get { return true; } } public void ProcessRequest(HttpContext context) { data = GetData(); string result; switch (context.Request.QueryString["requestType"]) { case "case": result = Foo.Bar(data).GetJSON(); break; //

Paypal Sandbox IPN not detecting Content-type

此生再无相见时 提交于 2019-12-13 05:16:55
问题 I've been using the past few hours attempting to figure out why the Paypal Sandbox IPN Simulator isn't detecting a Content-type on my request back. I didn't modify any of the code where the request back is made, so it's odd that it's not going through correctly. There was a similar question back in March, though the answer he marked didn't seem to do the trick for me. Does anyone have any idea on why this is happening? Has this happened to anyone else recently? public class PaypalIPN :