I have an ASPX page that I am using to write JSON. It works great in Firefox and Chrome, but when I try and use it in IE 8 it gives me an "The XML page cannot be displayed" error instead of allowing jQuery to load the JSON being written by the response. Here is what my code looks like:
I have a button that when clicked, will generate a PDF and write it out to the response.This is the basic structure of the code:
try { using(Stream stream = generatePdf()) {
[code]...
Downloading the file works fine, except that it doesn't complete the postback.If I were to throw an exception above file.Transmit, the error handling would work properly and I would see the message get displayed in my browser. However, if there is an exception after the file.Transmit then nothing happens. The user saves/opens the pdf and the page does not reload.How can I make it so that the postback always completes, that way I can display an appropriate message to the user?
What I have?I have a ASP.NET page which allows the user to download file a on a button click. User can select the file he wants from a list of available files (RadioButtonList) and clicks on download button to download it. (I should not provide link for each file that can be downloaded - this is the requirement).What I want?I want the user to download multiple files one by one by selecting the required radio button and clicking on the button.What problem am I facing?I can download the file for the first time properly. But, after downloading, if I select some other file and click on the button to download it, click event of the button does not post back and the second file will not be downloaded.I use the follwoing code on the button click event:
I know that you can enable NTLM authentication in an ASP.Net app using:
<authentication mode="Windows" />
However - I need to handle Forms, HTTP and other custom authentications in the same app, so ASP.Net's limited built-in support is no use.
The NTLM handshake should be fairly simple:
Request - [unauthenticated - no user info passed] Response - 401 Unauthorized WWW-Authenticate: NTLM Request - Authorization: NTLM <base64-encoded type-1-message>
[code]...
I need to parse type-1 and type-3 messages and generate a type-2 message.
The structure for those messages is well documented but fairly complex - it seems very messy to write my own message generators and parsers. I think the methods to read and write these messages should already be in .Net, but I haven't been able to find them.
Sys.Webforms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near ' i have kept button in updatepanel and i am getting this error
I've created 2 web user controls. A = User control that displays an image, and B is the user control that hosts A. I'm trying to stream an array of bytes to A, but it seems like the Response.BinaryWrite method completely overwrites any heirachial controls (I can't see any of B's other controls besides the image).
How do I get A to just display the image from the byte stream? It doesn't come from a database, it's an image I created on the fly.
I have trouble with JSON response compression. I look to response headers after uploading website to production server (Windows 2008, IIS 7) and found uncompressed response. Turning on "Enabled static compression" and ""Enable dynamic compression" in IIS control panel does not effect. ASPX pages was responsed gzipped, but webservice response uncompressed.
I looked to google, but no answer found about this trouble. Also, I try this [URL] way (and adding to web.config this module) - but this source is excellent working at development machine with ASP.NET development server (and have seven times response size reduced) and totally ignored at IIS7.
How I can apply gzip compression to json responses from my webservice?
I am having problems making an AJAX call when the response is over 2MB. Anything with a response under 2MB works fine. When the response is over 2MB, my "success" method never gets called. My application is ASP.NET MVC2.
I am making the call using the jQuery AJAX call: $.ajax({ type: "post", data: ajaxData, url: ajaxUrl, success: updateItems, cache: false });
In my controller, I am using the Json() action result method: public ActionResult GetItems(....) { ... return Json(packet); }
When I watch the call in Fiddler it comes back with a HTTP 500 response. I tried setting the maxJsonLength in the Web.config file as shown here, but that doesn't seem to make any difference. How to allow a response over 2MB?
I'm working on an MVC2 site that needs to update the values of a select list based on the value selected by a user in another list. This is the response I'm getting from my controller's JSON action:
I have a simple webservice that I would like to upload a file to. The problem is that I need the response in json.
Form my experience in order to get a response in Json my request has to have a content-type of 'application/json'. But ofcourse this cannot be the case with a file upload since the content type will have to be 'multipart/form-data'.
In my Json i want to return a value showing whether successful and a filename.
I try to get parse JSON response for the following link: https://graph.facebook.com/feed/?ids=135395949809348,149531474996&access_token=
The response is like that: { "135395949809348": { "data": [ { ....Some data }] } , "325475509465": { "data": [ { ....Some data...... }] } }
I use System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(string json) method. But the objects key names always different , so I can't define the class that can be used for parsing this response.Is anyone has any experience in parsing multiple id's response from Facebook?
Does anyone know how to convert backend data to a json response using .NET technologies? It'd be nice to have this and use jquery to call some information on the backend.
Below I have some code that I am using to give the user the option to save or open a file. However, for whatever reason, when it does this it appends everything that is in my .aspx page to the end of my file. I've no clue why this is happening or how to fix.
We have encountered this difference in file creation while using a HttpHandler Versus a Code Behind Aspx page. We are reading a saved jpg/png picture as byte array from a 'Image' field in sql server database and create a physical file in the server. Both the Aspx Page and Httphandler use the same code pasted below.
//Begin int docID = Convert.ToInt32(Request.QueryString["DocID"]); var docRow = documentDB.GetDocument(docID); // Retrieve the physical directory path for the Uploads subdirectory string destDir = Server.MapPath("../../Uploads").ToString() + "\"; string strFileName = destDir + DateTime.Now.ToFileTime() + "_" + docRow.DocName.ToString(); FileStream fs = new FileStream(strFileName, FileMode.CreateNew, FileAccess.Write); fs.Write(docRow.DocData, 0, docRow.DocData.Length); fs.Flush(); fs.Close(); // End
After the file is created, it is viewable as a jpg/png Image only in Aspx Code Behind. While in case of HttpHandler it is not a valid Image.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyPage.aspx.cs" Inherits="MyPage" %> <script type="text/javascript"> //<!-- I want to inject a JSON string here, which is generated per side-request --> function doStuffToMyData(){ // ..... } </script>
how I can inject a JSON string here? I got no problem generating the string, or parsing it in the browser..
It could be there's an easier way to do this? I basically want to manipulate the looks of the side, depending on changes to this data, so I figured it would be easiest to have the data as a JSON string.
I've been using OpenRasta to convert an old web application we have into something RESTful. IS it possible to serve up a resource (or specifically a list of resources) as both .aspx and JSON? I have tried this but no matter what I try I keep getting the .aspx back .. Here's a sample configuration:
Don't know if this is my machine getting back at me for all the times I've threatened to throw it through the wall, but VWD has a nasty habit of changing code on me. Weirdnees that I have noticed:- It will arbitrarily move the cursor position to a random location when I am typing.- It randomly partially removes a label from my footer div. I usually don't catch this one until I try to open the page.- It has a penchant for adding a random number of line breaks, at random. Right before sending this post it added about 200 line breaks instantly for no apparent reason.- After changing a property value for a text box, it deleted every control from the related view panel in a multiview control.- Changing something in the design view doesn't always change the related code in the source view (such as when adding or deleting controls).
Only the .aspx pages seem to be affected. I've not noticed any shenanigans in the code-behind pages. No one page is more affected than another, and it occurs across projects.I recently upgraded to VWD 2010 from VWD 2008 (that was painful). The 2008 version had some of the same quirks, but not to the extent of 2010. Has anyone else seen this kind of bizarre behaviour?
i built contact form in aspx 3.5 and i'm using jquery to send it to web service (asmx).the web service need to return success or error code. the problem is that at the web method i get only single value and not array. I'm kind of new in ajax and i tried a lot of solutions but without any results.. please if you can only explain me the principle of what to do it also be good..this is the client side:
when i debug i see that the input parameter "name" contains only one string - i dont know how to get the full json string that i send to the service and contains all the form data - i want to desirialize it to string array or something like, and process it.
I have an ASP.NET AJAX application, which is using .NET Framework 3.5. I have visual Studio 2008 installed on my developer machine. The AjaxControlToolKit dlls I have installed in my system right now come from the file "AspNetAjaxLibraryBeta0911.zip". The released date of the dlls in the file is 12/29/2009. Exploring the AjaxControlToolKit download site, I found that there is a more updated version, which release date was April 12th 2010.
I tried to update the AjaxControlKit.dll version to the newest one. I did this creating a path in my system: c:Program FilesAjaxControlToolKitWebFormsRelease then I placed there the new AjaxControlToolKit.dll and AjaxControlToolKit.pdb files. Then I right clicked on the name of the dll inside my Bin directory in my application and selected "Update Reference". After I did this I tested the application and is giving me Jscript error messages like: "htmlfile: member not found", or Microsoft Jscript Runtime error "lenth is null or not an object". I don't get these error messages if I come back to the previous version of the AjaxControlToolKit.