Search Results

Search found 222 results on 9 pages for 'ashx'.

Page 1/9 | 1 2 3 4 5 6 7 8 9  | Next Page >

  • My ashx stopped working (Works locally, but not online)

    - by Madi D.
    i have a simple ASHX file that returns pictures upon request (mainly a counter), previously the code simply fetched pre-made pictures(already uploaded and available) and sent them to the requester.. i just modified the code,so it would take a base picture, do some modifications on it, save it to the server, then serve it to the user.. tested it locally and it worked like a charm. however when i uploaded the code to my hosting service (Godaddy..) it didnt work. Can someone point the problem out to me? Note: ASHX worked with me before,so i know the web.config and IIS are handling them properly, however i think i am missing something .. Code: <%@ WebHandler Language="C#" Class="NWEmpPhotoHandler" %> using System; using System.Web; using System.IO; using System.Drawing; using System.Drawing.Imaging; public class NWEmpPhotoHandler : IHttpHandler { public bool IsReusable { get { return true; } } public void ProcessRequest(HttpContext ctx) { try { //Some Code to fetch # of vistors from DB int x = 10,000; // # of Vistors, fetched from DB string numberOfVistors = (1000 + x).ToString(); string filePath = ctx.Server.MapPath("counter.jpg"); Bitmap myBitmap = new Bitmap(filePath); Graphics g = Graphics.FromImage(myBitmap); g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; StringFormat strFormat = new StringFormat(); g.DrawString(numberOfVistors , new Font("Tahoma", 24), Brushes.Maroon, new RectangleF(55, 82, 500, 500),null); string PathToSave = ctx.Server.MapPath("counter-" + numberOfVistors + ".jpg"); saveJpeg(PathToSave, myBitmap, 100); if (File.Exists(PathToSave)) { ctx.Response.ContentType = "image/jpg"; ctx.Response.WriteFile(PathToSave); //ctx.Response.OutputStream.Write(picByteArray, 0, picByteArray.Length); } } catch (ArgumentException exe) { } } private ImageCodecInfo getEncoderInfo(string mimeType) { // Get image codecs for all image formats ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders(); // Find the correct image codec for (int i = 0; i < codecs.Length; i++) if (codecs[i].MimeType == mimeType) return codecs[i]; return null; } private void saveJpeg(string path, Bitmap img, long quality) { // Encoder parameter for image quality EncoderParameter qualityParam = new EncoderParameter(Encoder.Quality, quality); // Jpeg image codec ImageCodecInfo jpegCodec = this.getEncoderInfo("image/jpeg"); if (jpegCodec == null) return; EncoderParameters encoderParams = new EncoderParameters(1); encoderParams.Param[0] = qualityParam; img.Save(path, jpegCodec, encoderParams); } }

    Read the article

  • Use ASP.Net server control code generation from .ashx

    - by Matt Dawdy
    I'm trying to take an existing bunch of code that was previously on a full .aspx page, and do the same stuff in a .ashx handler. The code created an HtmlTable object, added rows and cells to those rows, then added that html table the .aspx's controls collection, then added it to a div that was already on the page. I am trying to keep the code in tact but instead of putting the control into a div, actually generate the html and I'll return that in a big chunk of text that can be called via AJAX client-side. HtmlTable errors out when I try to use the InnerHtml property (says it isn't supported), and when I try RenderControl, after making first a TextWriter and next an HtmlTextWriter object, I get the error that Page cannot be null. Has anyone done this before? Any suggestions?

    Read the article

  • .ashx cannot find type error on IIS7 , no problems on webdev server

    - by Aivan Monceller
    I am trying to make AspNetComet.zip work on IIS7 (a simple comet chat implementation) Here is a portion of my web.config. <system.web> <httpHandlers> <add verb="POST" path="DefaultChannel.ashx" type="Server.Channels.DefaultChannelHandler, Server"/> </httpHandlers> </system.web> <system.webServer> <handlers> <add name="DefaultChannelHandler" verb="POST" path="DefaultChannel.ashx" type="Server.Channels.DefaultChannelHandler, Server"/> </handlers> </system.webServer> When I publish the website on my localhost IIS7 I receive an error: POST http://localhost/DefaultChannel.ashx 500 Internal Server Error Could not load type 'Server.Channels.DefaultChannelHandler The target framework of this project is .Net 2.0 I tried the Classic and Integrated Mode application pool for .Net 2.0 with no luck. I also tried converting the project to 4.0 and tried the Classic and Integrated Mode application pool for .Net 4.0 with no luck. I also tried adding the managed handler through IIS Manager's Handler Mappings. If you have time please download the source (184kb) to reproduce the problem on your own machine. The zip contains a VS2010 solution (.Net 2.0). You could also try to convert this to .Net 4.0 I am using Windows 7 anyway if that matters. If you need more details, please drop your comments below. This is working fine by the way on my webdev server.

    Read the article

  • Using URL Routing for Web Forms with .ashx files

    - by RandomBen
    I am developing a .NET 3.5 Web Forms based website that uses URL Routing. So far I have created a few routes and I have had no issue. I now have a .ashx file that is going to handle sending .pdf files from a table in SQL Server to the website when someone clicks on a link. Normally when I create a Handler it would look like this: return BuildManager.CreateInstanceFromVirtualPath("~/ViewItem.aspx", typeof(Page)) as Page; For my .ashx file I tried: return BuildManager.CreateInstanceFromVirtualPath("~/FileServer.ashx", typeof(Page)) as Page; This doesn't work though because fileserver.ashx is not a page so casting it as typeof(Page)) as Page is going to fail. What do I cast the VirtualPath as instead of Page or is there some other way I should be doing this.

    Read the article

  • Call Javascript method from .ashx file

    - by Prasad Jadhav
    From my previous question(Create json using JavaScriptSerializer), In .ashx file I am printing the json object using: context.Response.ContentType = "application/json"; context.Response.Write(json); I am calling this .ashx file from default.aspx which has some javascript function inside its <head> tag. My question is : How will I be able to call the javascript function from .ashx file after context.Response.Write(json);?

    Read the article

  • C# How to compress .ashx content?

    - by Martijn
    In my web application I use an ashx file to write a file to the browser. I've noticed that there's no compression over the .ashx file, but only over my .aspx files. Is it possible to compress .ashx? And if it is possible, how?

    Read the article

  • c# asp.net How to return a usercontrol from a handeler ashx?

    - by Justin808
    I want to return the HTML output of the control from a handler. My code looks like this: <%@ WebHandler Language="C#" Class="PopupCalendar" % using System; using System.IO; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public class PopupCalendar : IHttpHandler { public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/plain"; System.Web.UI.Page page = new System.Web.UI.Page(); UserControl ctrl = (UserControl)page.LoadControl("~/Controls/CalendarMonthView.ascx"); page.Form.Controls.Add(ctrl); StringWriter stringWriter = new StringWriter(); HtmlTextWriter tw = new HtmlTextWriter(stringWriter); ctrl.RenderControl(tw); context.Response.Write(stringWriter.ToString()); } public bool IsReusable { get { return false; } } } I'm getting the error: Server Error in '/CMS' Application. Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 14: System.Web.UI.Page page = new System.Web.UI.Page(); Line 15: UserControl ctrl = (UserControl)page.LoadControl("~/Controls/CalendarMonthView.ascx"); Line 16: page.Form.Controls.Add(ctrl); Line 17: Line 18: StringWriter stringWriter = new StringWriter(); How can I return the output of a Usercontrol via a handler?

    Read the article

  • FullCalendar events from asp.net ASHX page not displaying

    - by Steve Howard
    Hi I have been trying to add some events to the fullCalendar using a call to a ASHX page using the following code. Page script: <script type="text/javascript"> $(document).ready(function() { $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month, agendaWeek,agendaDay' }, events: 'FullCalendarEvents.ashx' }) }); c# code: public class EventsData { public int id { get; set; } public string title { get; set; } public string start { get; set; } public string end { get; set; } public string url { get; set; } public int accountId { get; set; } } public class FullCalendarEvents : IHttpHandler { private static List<EventsData> testEventsData = new List<EventsData> { new EventsData {accountId = 0, title = "test 1", start = DateTime.Now.ToString("yyyy-MM-dd"), id=0}, new EventsData{ accountId = 1, title="test 2", start = DateTime.Now.AddHours(2).ToString("yyyy-MM-dd"), id=2} }; public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json."; context.Response.Write(GetEventData()); } private string GetEventData() { List<EventsData> ed = testEventsData; StringBuilder sb = new StringBuilder(); sb.Append("["); foreach (var data in ed) { sb.Append("{"); sb.Append(string.Format("id: {0},", data.id)); sb.Append(string.Format("title:'{0}',", data.title)); sb.Append(string.Format("start: '{0}',", data.start)); sb.Append("allDay: false"); sb.Append("},"); } sb.Remove(sb.Length - 1, 1); sb.Append("]"); return sb.ToString(); } } The ASHX page gets called and returnd the following data: [{id: 0,title:'test 1',start: '2010-06-07',allDay: false},{id: 2,title:'test 2',start: '2010-06-07',allDay: false}] The call to the ASHX page does not display any results, but if I paste the values returned directly into the events it displays correctly. I am I have been trying to get this code to work for a day now and I can't see why the events are not getting set. Any help or advise on how I can get this to work would be appreciated. Steve

    Read the article

  • asp.net .ashx error in sharepoint

    - by Kushal
    Hello All I am trying to shift my asp.net 3.5 application (C#) to sharepoint. I have used one .ashx(web handler) file for multiple file upload control in my application Now it works perfectly locally in asp.net but when i do the same thing with sharepoint with no change in code it stops working. I dont know if i need to add some dll or any supportive file to get that file upload page (using .ashx file) working in sharepoint Please help

    Read the article

  • internet explorer ashx file problem

    - by vondip
    My problem is a bit complicated: I am writing in c#, asp.net and using jquery I have a page that sends requests to the server using jquery's ajax method. I have a ashx file (handler) to respond to these request. User can perform several changes on several pages, then use some method that will call the ajax method. My ashx file reads some values From the session variables and acts accordingly. This works fine in all browsers but in internet explorer. In internet explorer the session seems to hold old information (old user ids'). It's incredible, the same code works fine in firefox, chrome and safari but fails with ie. What could be causing it? I have no clue where to even start looking for a solution. btw, Sorry for the general title, couldn't figure out how to explain in just few words. Thank You!

    Read the article

  • Getting Session in Http Handler ashx

    - by prakash
    Hi All, I am using Http Handler ashx file for showing the images. I was using Session object to get image and return in the response Now problem is i need to use custom Session object its nothing but the Wrapper on HttpSession State But when i am trying to get existing custom session object its creating new ... its not showing session data , i checked the session Id which is also different Please adive how can i get existing session in ashx file ? Note: When i use ASP.NET Sesssion its working fine [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class GetImage : IHttpHandler, System.Web.SessionState.IRequiresSessionState {

    Read the article

  • Display an ashx image using jQuery?

    - by Abe Miessler
    I've been trying to use the jQuery plugin Colorbox to display images I have in my DB through an ashx file. Unfortunately it just spits a bunch of gibberish at the top of the page and no image. Can this be done? Here is what I have so far: $(document).ready ( function () { $("a[rel='cbImg']").colorbox(); } ); ... <a rel="cbImg" href="HuntImage.ashx?id=15">Click to see image</a>

    Read the article

  • .NET, ASHX, "Server cannot append header after HTTP headers have been sent" after sending PDF Streem

    - by Inturbidus
    I visit my ASHX file, and it outputs a PDF perfectly. If I visit the very same ASHX with a different query string (I append DateTime.Now.Ticks to the end each visit), and I get this error: Server cannot append hader after HTTP headers have been sent. My code is below: copy.CloseStream = false; document.Close(); var r = context.Response; r.ExpiresAbsolute = DateTime.Now; r.BufferOutput = true; r.ContentType = "application/pdf"; r.AppendHeader("Content-Type", r.ContentType); r.AppendHeader("Content-disposition", "inline; filename=" + context.Server.UrlEncode(formType.File_Name)); r.BinaryWrite(copyStream.ToArray()); r.StatusCode = 200; r.End(); originalReader.Close(); copy.CloseStream = true; copy.Close(); There is no other place in this code that headers are sent. You are seeing the entire interaction with the Response object. I've tried to use r.Flush(); and r.End(); I've also tried not sending them if they are already there, but this causes other issues.

    Read the article

  • Error during access to .ashx page in IIS 7 on windows 2008

    - by Rodnower
    Hello, I have web site on IIS 7 on Windows 2008, when I try to access the "page" (that correctly bound to namespace in web.config) I get error: "The required page cannot be accessed because the related configuration data for the page is invalid". Very important to say that on windows 7 I have this working. May be this is because I don't see ASP.NET area in management window? If yes, can yo tell me how I install ASP.NET on IIS 7 on windows 2008? Thank you for ahead.

    Read the article

  • ASP.Net AJAX controls, adding via .ashx page

    - by Matt Dawdy
    Okay, this is a continuation of a previous question of mine, but it is distinct enough to be its own question. Based on user interaction, I'm calling a .ashx handler via a jquery ajax call, and that handler is building some html for me that includes some Telerik controls like a masked textbox (masked for a phone number like "(###) ###-####". I got around all the hurdles of using Render() to get the html output of a server control even when it doesn't have a "Page" object or a ScriptHandler object. However, when I show the control to a user, I see the mask in the text of the textbox, but the mask doesn't "work" in the sense that when a user starts typing, it is as if the mask is really just text. So, my question is, after putting the html code out for a masked textbox, how do I tell whatever javascript is supposed to mask the input to really start masking on that specific control? I really hope this made sense. Please tell me if you need any clarification.

    Read the article

  • AjaxPro and ActionChart.ashx are not working together?

    - by jeneesh
    Hi, am using actionchart in one of my asp.net 2.0 application. also now am using "AjaxPro.AjaxHandlerFactory,AjaxPro.2" in this application for that i have added one handler in web.config file. <httpHandlers> <!--<add verb="" path=".ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro.2"/>--> </httpHandlers> </system.web> like that. After that, my action chart is not working!!! But if am commenting the handler part, action chart will work, but ajaxPro willnot work. Please help me ASAP. I have to resolve by the end of today [email protected]

    Read the article

  • Viewstate in a .ashx Handler?

    - by Matt Dawdy
    I've got a handler (list.ashx for example) that has a method that retrieves a large dataset, then grabs only the records that will be shown on any given "page" of data. We are allowing the users to do sorting on these results. So, on any given page run, I will be retrieving a dataset that I just got a few seconds/minutes ago, but reordering them, or showing the next page of data, etc. My point is that my dataset really hasn't changed. Normally, the dataset would be stuck into the viewstate of a page, but since I'm using a handler, I don't have that convenience. At least I don't think so. So, what is a common way to store the viewstate associated with a current user's given page when using a handler? Is there a way to take the dataset, encode it somehow and send that back to the user, and then on the next call, pass it back and then rehydrate a dataset from those bits? I don't think Session would be a good place to store it since we might have 1000 users all viewing different datasets of different data, and that could bring the server to its knees. At least I think so. Does anyone have any experience with this kind of situation, and can you give me any advice?

    Read the article

  • How to handle null return from custom HttpHandler in asp.net?

    - by Campos
    I'm using a custom ashx HttpHandler to retrieve gif images from a database and show it on a website - when the image exists, it works great. However, there are cases when the image will not exist, and I'd like to have the html table holding the image to become invisible so the "image not found" icon is not shown. But since the HttpHandler is not synchronous, all my attempts checking for image size at Page_Load were frustrated. Any ideas on how this can be accomplished?

    Read the article

  • jQuery ajax call failing with undefined error

    - by Groo
    My jQuery ajax call is failing with an undefined error. My js code looks like this: $.ajax({ type: "POST", url: "Data/RealTime.ashx", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", timeout: 15000, dataFilter: function(data, type) { alert("RAW DATA: " + data + ", TYPE: "+ type); return data; }, error: function(xhr, textStatus, errorThrown) { alert("FAIL: " + xhr + " " + textStatus + " " + errorThrown); }, success: function(data) { alert("SUCCESS"); } }); My ajax source is a generic ASP.NET handler: [WebService(Namespace = "http://my.website.com")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class RealTime : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; context.Response.Write("{ data: [1,2,3] }"); context.Response.End(); } public bool IsReusable { get { return false; } } } Now, if I return an empty object ("{ }") in my handler, the call will succeed. But when I return any other JSON object, the call fails. The dataFilter handler shows that I am receiving a correct object. Firebug shows the response as expected, and the JSON tab shows that the object is parsed correctly. So what could be the cause?

    Read the article

  • response.write only working IE for ASP.NET

    - by slowlycooked
    I'm using uploadify (http://www.uploadify.com/) to upload video to my site then convert them into *.flv using ffmpeg and play preview. But it dosen't fully working with firefox, chrome or safari. uploadify provides a onComplete interface, so when the script (.ashx, .php) used on your site for saving uploaded files. you can use response.write("blabla") or (echo "blabla") to invoke the javascript function that registed as OnComplete. i have test with few video files like avi, mpg, mp4, they are less then 50mb,and they all worked with all 4 browsers. However, when i was trying to upload a 75mb mp4 file, it worked in IE, but didn't working in other three. I can see the .flv file has been create in the upload folder, i can see debug messsage output after response.write("blabla"), but the javascript function was not invoked. i.e. the preview didn't play. anyone knows why? is there a timeout or something on response.write so after a period of time it wont work? e.g. 75mb file took longer time to convert than other smaller size file i tried. thansk

    Read the article

  • Does Visual Studio Localhost ASP.NET debugging allow caching?

    - by Joel
    The title pretty much says it all, but here's the issue. I have an generic handler that returns Javascript; the only line of code that deals with caching that I put in is the following: context.Response.Cache.SetCacheability(HttpCacheability.Public); context.Response.Cache.SetExpires(DateTime.Now.AddYears(1)); context.Response.ContentType = "text/javascript"; context.Response.Write("result"); I'm debugging on localhost. out of Visual Studio 2008, (that's "localhost." so fiddler picks it up) and Fiddler2 sees the expire date, but says that the cache header is set to private, and the page isn't being cached. Can anybody see what's going wrong here?

    Read the article

1 2 3 4 5 6 7 8 9  | Next Page >