ashx

How do you call an ASHX from JavaScript?

旧城冷巷雨未停 提交于 2019-12-03 20:18:22
I want to call an ASHX file and pass some query string variables from JavaScript and get the return string into a string in the JavaScript. How would I do this? The ASHX file is already coded to response.write a string based on whatever the query strings are. Something like this?: function createXMLHttpRequest() { try { return new XMLHttpRequest(); } catch(e) {} try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {} try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} alert("XMLHttpRequest not supported"); return null; } var xmlHttpReq= createXMLHttpRequest();

Session Not working in Generic Handler .ashx in Firefox

感情迁移 提交于 2019-12-03 17:16:54
I have created .ashx which implemented IRequiresSessionState, so I can create session variables in that ashx, it worked in IE, but doesn't work in Firefox. When access this session variable from other pages it's NULL. any idea? thx. Perhaps you don't allow cookies in Firefox. Check that! If you don't want to enable cookies, enable the cookieless session. Make cookies enabled in web.config <system.web> <sessionState cookieless="true"></sessionState> </system.web> 来源: https://stackoverflow.com/questions/2729825/session-not-working-in-generic-handler-ashx-in-firefox

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

允我心安 提交于 2019-12-03 16:00:02
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 ASHX handler? Or is it more complex than that? Thank you, Michael I guess if all you want to do is read

how to call ASHX handler and getting the result back

微笑、不失礼 提交于 2019-12-03 14:19:38
I have created a Handler which return integer value after doing some database work. i would like to know how can i get that value and assign that value to Label by calling that handler. I have googled it and most of the example uses Jquery.AJAX calls to retrieve the value. I am sure i can also get the value by using that. BUT for some limitation in my company i am restricted to use code behind. Any example will help. Handler: http://somesite.com/Stores/GetOrderCount.ashx?sCode=VIC which returns: 3 need to assign this to a label control i have tried this much so far. HttpWebRequest request =

Only count a download once it's served

删除回忆录丶 提交于 2019-12-03 13:27:15
问题 We have this code which serves a download: public class downloadRelease : IHttpHandler { public void ProcessRequest (HttpContext context) { -- snip -- context.Response.Clear(); context.Response.ContentType = "application/octet-stream"; context.Response.AddHeader("Content-Disposition", "attachment; filename=" + OriginalFileName); context.Response.WriteFile(Settings.ReleaseFileLocation + ActualFileName); // Log download Constructor.VersionReleaseDownload.NewReleaseDownload(ActualFileName); It

IIS 7.0 503 errors with generic handler (.ashx) implementing IHttpAsyncHandler

谁说胖子不能爱 提交于 2019-12-03 07:46:14
问题 I'm running into some performance issues using a generic handler that implements IHttpAsyncHandler. At its simplest, the handler receives a GET request, and 20 seconds later ends the response after writing '< timeout / >' to the response. When hammering the .ashx with 10000-20000 simultaneous requests, it fails with 503 server unavailable after precisely 5000 requests. When switching to synchronous mode, and ending the request immediately, the problem goes away. I've tinkered with a number of

file upload using jquery ajax and asp.net handler

亡梦爱人 提交于 2019-12-03 07:16:24
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.Server.MapPath("~/assets/common/CompetitionEntryImages/"); var extension = Path.GetExtension(postedFile

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

落爺英雄遲暮 提交于 2019-12-02 15:15:55
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? 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 route) - but I'm not sure that is the best approach unless it is to re-use existing code. Sorry guys, the

Generic handler parameter size limit?

二次信任 提交于 2019-12-02 05:44:59
问题 I have some JavaScript code which generates a very long script and than posts it back to the server to a generic handler for creating a csv. My JavaScript Code for sending the data is: function postwith(to, p) { var myForm = document.createElement("form"); myForm.method = "post"; myForm.action = to; for (var k in p) { var myInput = document.createElement("input"); myInput.setAttribute("name", k); myInput.setAttribute("value", p[k]); console.log(k+":"+p[k]); myForm.appendChild(myInput); }

Handler with IRequiresSessionState does not extend session timeout

早过忘川 提交于 2019-12-02 04:29:50
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 client to the server code MyHandler do not extend the life of the session! So even if the user is busy