ihttphandler

Set .ashx as start “page” for web application

别等时光非礼了梦想. 提交于 2019-12-11 17:52:50
问题 Is it possible to set an .ashx file as the starting (or default) page for a web application? If so, how is it done? Edit - Some good suggestions. I have added "Default.ashx" to the IIS Default Documents and "Enabled Default Document" on the website, however, it only displays a directory listing even though I have disabled directory browsing. Any other suggestions would be appreciated. (IIS Version 5.1) Edit - Restarted IIS and it works. Question - May I also ask if it is possible to set the

Httphandler for WebDav requests

好久不见. 提交于 2019-12-11 04:24:16
问题 I am trying to write a asp.net httphandler for handling webdav requests with IIS. I am extending the IHttpHandler interface and implementing the ProcessRequest. public class clsMyHandler : IHttpHandler { public void ProcessRequest(System.Web.HttpContext context) { StreamWriter sw = new StreamWriter(@"C:\requestLog.txt",true); sw.WriteLine("Got a request at " + DateTime.Now.ToString()); sw.Close(); } public bool IsReusable { get { return true; } } } It's a simple handler for my test purpose to

Firefox not handling content type correctly when using IHttpHandler

五迷三道 提交于 2019-12-11 03:46:27
问题 Firefox is for some reason not properly handling content sent through my .NET HTTP handler; it appears to be not honoring the content type header. Rather, it sees the content as being HTML. The URL mapped to the request even has a .csv extension. Internet Explorer and Chrome are doing the right thing. The problem is happening for both a "text/css" and an "application/pdf" handler. Here's a fragment of my HTTP handler's ProcessRequest method: public void ProcessRequest(HttpContext context) { /

using HttpHandlerFactory to render CMS and physical pages

女生的网名这么多〃 提交于 2019-12-10 12:14:14
问题 I am in the middle of writing a CMS system and after reading and working through a few examples, I have settled on HttpHandlerFactory to perform what I need. the key point is our sites are generally a mix of copy and registration processes. So I currently need to use the default HttpHandler for aspx to render the physical registration pages until I can work a way to content manage them too. after creating the handler class I added the following to my website's web config <add verb="*" path="*

ASP.NET C# OutofMemoryException On Large File Upload

自古美人都是妖i 提交于 2019-12-09 13:25:05
问题 I have the following file upload handler: public class FileUploader : IHttpHandler { public void ProcessRequest(HttpContext context) { HttpRequest request = context.Request; context.Response.ContentType = "text/html"; context.Response.ContentEncoding = System.Text.Encoding.UTF8; context.Response.Cache.SetCacheability(HttpCacheability.NoCache); var tempPath = request.PhysicalApplicationPath + "\\Files\\TempFiles\\"; byte[] buffer = new byte[request.ContentLength]; using (BinaryReader br = new

Resizing an image in VB.NET

流过昼夜 提交于 2019-12-08 07:47:03
问题 I have the following code in my IHttpHandler: Dim MemoryStream1 As New System.IO.MemoryStream MemoryStream1.Write(SqlDataReader1("cover"), 0, SqlDataReader1("cover").Length - 1) Dim Bitmap1 As System.Drawing.Bitmap = System.Drawing.Bitmap.FromStream(MemoryStream1) Dim Width1 As Integer = Bitmap1.Width Dim Height1 As Integer = Bitmap1.Height Dim Width2 As Integer = 90 Dim Height2 As Integer = Height1 * Width1 / Width1 Dim Bitmap2 As System.Drawing.Bitmap = New System.Drawing.Bitmap(Width2,

How do I persist session values in ASP.NET?

六眼飞鱼酱① 提交于 2019-12-08 07:00:50
问题 I'm implementing IHttpHandler and IRequiresSessionState and I'm using context.Session but after I set up a value in Session, it's lost in the next request. What can I do to persist the values ? $.ajax({ url: "/test.test", type: "POST", data: "{'type':'GetStep'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (result) {...} }); The second call is similar to this, but the values that get set when I call this function are also lost on the next request.

Resizing an image in VB.NET

夙愿已清 提交于 2019-12-08 03:11:27
I have the following code in my IHttpHandler: Dim MemoryStream1 As New System.IO.MemoryStream MemoryStream1.Write(SqlDataReader1("cover"), 0, SqlDataReader1("cover").Length - 1) Dim Bitmap1 As System.Drawing.Bitmap = System.Drawing.Bitmap.FromStream(MemoryStream1) Dim Width1 As Integer = Bitmap1.Width Dim Height1 As Integer = Bitmap1.Height Dim Width2 As Integer = 90 Dim Height2 As Integer = Height1 * Width1 / Width1 Dim Bitmap2 As System.Drawing.Bitmap = New System.Drawing.Bitmap(Width2, Height2) Dim Graphics1 As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(Bitmap2) Graphics1

Castle windsor and IHttpHandler and IHttpHandlerFactory

我的未来我决定 提交于 2019-12-08 02:03:52
问题 I'm developing a RIA application where there is javascript on the client (i'm using Ext) and .NET on the server, for json-rpc I'm using Jayrock which is a nice library (at least for me) as it is simple and works well, Ive used it in the past. Jayrock uses Web Handlers to serve the json-rpc request, you code a class that implements IHttpHandler and derives from a Jayrock class with some attributes, and it does the rest to provide a javascript class to the browser to do its magic. Now, normally

How do I persist session values in ASP.NET?

那年仲夏 提交于 2019-12-07 18:00:38
I'm implementing IHttpHandler and IRequiresSessionState and I'm using context.Session but after I set up a value in Session, it's lost in the next request. What can I do to persist the values ? $.ajax({ url: "/test.test", type: "POST", data: "{'type':'GetStep'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (result) {...} }); The second call is similar to this, but the values that get set when I call this function are also lost on the next request. public void ProcessRequest (HttpContext context) { context.Session ["Game"] = new Game (); // next time it