ashx

How do I call an ASHX from inside an ASPX.VB function?

走远了吗. 提交于 2019-12-02 03:11:15
I need to get a value from an API I made with ASHX and normally it is called from javascript but I need to call it right in ASP.NET I figured this shouldn't be a problem but I'm not sure the syntax. Well you have a couple options You can refactor the code in your ASHX to be in a shared library so you can access the methods directly and so can the handler. You can instantiate the handler and invoke the members if they aren't private. You can create a webrequest to the handler and handle the response. These are just a few of the easy ways. I personally like the first method because it promotes

Generic handler parameter size limit?

会有一股神秘感。 提交于 2019-12-02 03:07:08
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); } document.body.appendChild(myForm); myForm.submit(); document.body.removeChild(myForm); } In my console I

How to access localised resources in an .ashx file?

坚强是说给别人听的谎言 提交于 2019-12-02 02:35:32
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. Following code worked for me. HttpContext.GetGlobalResourceObject("classKey", "resourceKey") as string; 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 compiled once to create the Resources objects from resx files. 来源: https://stackoverflow.com/questions/3555002/how

ashx files in asp.net

一个人想着一个人 提交于 2019-11-30 13:11:32
问题 When do you use ashx files in asp.net web application ? Can some one explain in simple terminology with a pratical example ? I understood from the msdn that .ashx files implements ihttphandler but i could not get much explanation from here http://msdn.microsoft.com/en-us/library/system.web.ihttphandler.aspx, Can some one explain it clearly for me? 回答1: In short, a file ASHX is an ASPX file, minus all plumbing ASP.NET webform. I am using ASHX to generate PDF files on the fly, and download them

Visual Studio ASP.Net expand and collapse issue in ashx generic handlers

邮差的信 提交于 2019-11-30 08:40:39
I have Visual Studio 2008 Professional and I am having issues with expanding and collapsing method code blocks in ASP.Net Generic Handler pages (.ashx) I would have thought you could do the same thing like in the code behind of .aspx web pages. I have this same issue on other boxes even with VS 2008 Standard and VS 2005 Professional. All boxes have been fully patched (OS and Visual Studio.) Does anybody have any suggestions as to enabling this feature? You can force Visual Studio to ignore the fact that it's code in front you're working with by going to: Tools | Options And opening the "Text

ashx files in asp.net

五迷三道 提交于 2019-11-30 06:35:40
When do you use ashx files in asp.net web application ? Can some one explain in simple terminology with a pratical example ? I understood from the msdn that .ashx files implements ihttphandler but i could not get much explanation from here http://msdn.microsoft.com/en-us/library/system.web.ihttphandler.aspx , Can some one explain it clearly for me? Larry In short, a file ASHX is an ASPX file, minus all plumbing ASP.NET webform. I am using ASHX to generate PDF files on the fly, and download them. Similarly, I use them to generate thumbnails on the fly and download them. This could work very

Downloading files using ASP.NET .ashx modules

大憨熊 提交于 2019-11-30 05:44:59
问题 I have ASP.NET page with an iframe on it for displaying some pdf reports on this page. When user select the report type from dropdown, I add the needed for report data into the ASP.NET Session and change the attribute "src" of the iframe to .ashx module address which generates the .pdf report. But if Adobe glug-in for viewing .pdf files in browser is not installed, browser proposes to save report file and name of the proposed file is "HandlerName.ashx". But I want to make the browser proposed

Catch exceptions in ASP.NET resulting from Generic Handler (ashx) file

浪子不回头ぞ 提交于 2019-11-29 12:50:27
I am trying to get a different server side stack functioning with my ASP.NET site. My ashx file seems to be throwing a 500 Internal Server Error. How do I figure out what exception this ashx file is throwing or the reason the 500 is being thrown? When I attach to my IIS 7 w3wp.exe process, it doesn't throw an exception, but I'm reading that this is likely the case. The ashx file lives in the root directory of my ASP.NET site, and the Properties have it set to compile. GET http://uhc-8:8883/MyApp/ExtDirectProxy.ashx 500 (Internal Server Error) index.html:27 Uncaught TypeError: Cannot read

response redirect from .ashx file

旧时模样 提交于 2019-11-29 09:21:56
I have ashx file and I want to redirect from ashx to aspx page. Some solution? void ProcessRequest(HttpContext context) { context.Response.Redirect(newUrl); } Mark H Using context.Response.Redirect(newUrl); results in a page that says: "Object moved to here ." Update: This happened because I signed out, in that case the answer is to use FormsAuthentication.RedirectToLoginPage(); musatotan I found a solution and it should work fine: context.Response.ContentType = "text/plain"; if (controlcase) { //Write code, what you want... context.Response.Write("This is result"); } else { context.Response

What are the benefits of an ASHX handler file in asp.net?

≡放荡痞女 提交于 2019-11-29 01:30:56
What are the benefits of using an ashx, or handler? Also, do I need them if I use MVC (and why not)? Does the framework matter (2.0+)? Why would I want to use a handler? I was recently recommended to use one for retrieving an image but I don't know why. Thank you for your time. Edit - is a handler faster? Just a few examples: Dynamic image generation : You can write handlers that return data driven images by creating an ASHX handler that returns image data and then using that URL in your tags. e.g. <img alt="user's custom icon" src="Icon.ashx?username=bob"></img> Returning REST-based XML or