httphandler

HttpHandler not retaining filenames on download

本小妞迷上赌 提交于 2021-02-11 13:00:44
问题 I am using an HttpHandler to serve documents within my ASP.NET web application. I can get it to work just fine with one issue which I can't quite figure out -- the filename isn't retained. For example, if I am trying to serve a document called "New Patient Information Form.docx" and my handler is called "GetDocument.ashx" the file is downloaded as "GetDocument.docx" and "GetDocument(1).docx", "GetDocument(2).docx" etc. each time I download the file. I want to use a handler instead of linking

How to send array in Mailgun handlebars Context

天涯浪子 提交于 2021-02-11 12:41:56
问题 I am trying to send an array in Mailgun email as a list for this I did: $result = $mgClient->messages()->send( $this->mailgunDomain, [ . . . 'v:list' => json_encode($finalList), ]); $finalList is a 2d array which looks something like this: [ [ "key" => "someKey" "value" => "someValue" ], ... ] But now the main problem is I do not know how can I use this array as handlebars context Because, I get: { "list": "[{"key":"someKey","value":"someValue"}]" } I want: { "list": [{"key":"someKey","value"

NInjecting into a asp.net website httphandler

六月ゝ 毕业季﹏ 提交于 2021-01-28 10:10:18
问题 I'm trying to inject a service into a HttpHandler i wrote. But all I'm getting is a Service with a null value. I have created a small example to illustrate my problem using a normal asp.net website. public class MyHandler :IHttpHandler { [Inject] public IHelloService HelloService { get; set; } public void ProcessRequest(HttpContext context) { context.Response.Write(HelloService.Hello()); } public bool IsReusable { get; private set; } } The Service public interface IHelloService { string Hello

How to create and add custom httpHandler to existing IIS WebSite

放肆的年华 提交于 2021-01-21 10:51:34
问题 I need to add a custom httpHandler to an existing IIS WebSite. I have a Windows Server 2012 R2 with IIS and in IIS i have a WebSite which runs an ASP.NET solution where i have no access to the sources. The ApplicationPool is configured to run with .Net 4.0 and in Integrated Mode. We want to develop a custom httpHandler as .dll and register this within the WebSite under Handler Mappings. To do so we have created in Visual Studio 2015 a new Dynamic Linked Libary project with the following code:

How to set up HTTPHandler for python logging

五迷三道 提交于 2020-07-18 11:03:01
问题 I'm trying to use HTTPHandler class of standard python logging library to send logs. I need to make a https post request with basic credentials(username and password). This is how i'm setting up the HTTPHandler- host = 'example.com' url = '/path' handler = logging.handlers.HTTPHandler(host, url, method='POST', secure=True, credentials=('username','password'), context=None) logger.addHandler(handler) But the problem is, I'm not getting anylogs in my remote server.I'm not even seeing any

Get images from database in Entity Framework by passing id into ashx

余生颓废 提交于 2020-01-25 08:03:07
问题 In my homepage I Have a list of articles. When I click on any article it redirects to next page to view images of that article. in URL I am passing article id ( pr_id ) to next page. So to display resized images I am using handler. I need to display all the images which are associated to that pr_id . How do I get all the images which are stored in DB by passing id in Entity Framework. I need to get all the images which are associate to that pr_id . I don't know where I am kind of stuck. In my

How do I get the Silverlight Pivot Server application to run on IIS 6?

旧街凉风 提交于 2020-01-25 04:10:33
问题 How do I get the Pivot Server Application to run on IIS 6? The handlers for the cxml don't seem to be registering properly, because I get a 404 for requests to .cxml files. The closest solution I can see so far is on http://forums.silverlight.net/forums/p/192470/454278.aspx , but this doesn't seem to be the right way to do it. I see the handlers in the web.config under both system.webserver/handlers and system.web/httpHandlers. 回答1: In addition to the extension mappings proposed by gsimard on

i can't add #region to .ashx in visual studio 2010

纵然是瞬间 提交于 2020-01-24 12:54:07
问题 i create a generic handler (ashx) but i am trying to add region in my code like the following #region MyRegionName context.Response.ContentType = "text/plain"; context.Response.Write("Hello World"); #endregion there is no error but the problem that there is no expand and collapse. please any advice ? note: i am using visual studio 2010 回答1: hi i think i figure out the answer my self in visual studio go to: 1- Tools -> option -> select Text Editor. 2- in the right pane add an extension "ashx"

Difference between Stream.CopyTo and MemoryStream.WriteTo

爷,独闯天下 提交于 2020-01-23 04:15:11
问题 I have a HttpHandler returning an image through Response.OutputStream . I have the following code: _imageProvider.GetImage().CopyTo(context.Response.OutputStream); GetImage() method returns a Stream which is actually a MemoryStream instance and it is returning 0 bytes to the browser. If i change GetImage() method signature to return a MemoryStream and use the following line of code: _imageProvider.GetImage().WriteTo(context.Response.OutputStream); It works and the browser gets an image. So

ASP.NET add a httphandler to edit downloaded file name

╄→尐↘猪︶ㄣ 提交于 2020-01-21 07:00:07
问题 I have in my project a page DownloadDocument.aspx and it's codebhind is DownloadDocument.aspx.cs In my DownloadDocument.aspx i have an anchor which take a dynamic link like this: <a id="downloadLink" runat="server" style="margin:5px" href="<%# CONTENT_DIRECTORY_ROOT + document.Path %>">Download current file</a> I want to add a httphandler to control the file name downloaded, How can i do it? Thanks in advance. 回答1: How about using a generic handler (.ashx) for this? You need to add loading