The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the service type with RequirementsMode setting as 'Allowed' or 'Required'.
when i try to access wcf service i get this error: the reason is HttpContext.Current is null, what should i do in this case?
Object reference not set to an instance of an object.
System.Web.Script.Serialization.JavaScriptSerializer s = new System.Web.Script.Serialization.JavaScriptSerializer();
Person p = new Person() { FirstName = "First name", LastName= "last name" };
string json = s.Serialize(p);
System.Web.HttpContext.Current.Response.Write("jsoncallback" + json);} //error
I am developing web application and in application i need to make call of jQuery using .ajax(); method with datatype is set jsonp. Now all works well with limited data but problem start to occur when data size is increasing......
I need to to export a file to the user. It takes 1-2 min to generate the file so I'd like to have the page go into a kind-of modal mode with a layover on the page and a 'Working' spinner showing. The problem is I can't make the modal stuff go away after Save File dialog is closed.
How can I remove the layover after the dialog is done?
How can I implement Jquery JSONP in my ASP.NET project. My application flow is described below:
1) I am opening a HTTP page, where I have got JQuery login dialog box, from which username and password is posted to my Login.aspx page, which has got one method "GetLoginDetails" which takes posted username and password and sends to a WEBSERVICE which checks the users name and password and return back with "success=true"
2) so in my response I get "success=true", I read that value from jquery and works according to responded text on my client side it display message "Logged in Successfully".
I am trying out jsonp with jQuery. I found many examples on the web and I believe my code is correct, but its still not working for me.
My web service:
using System.Web; using System.Web.Script.Services; using System.Web.Services; using System.Web.Script.Serialization;..........
Firebug shows this is a success, but I am getting null from the alert. I have my webservice in iis7 locally and I am testing through my debug in my client project.
I have a simple script making a request to the server:
var DTO = { 'path': path }; var url = 'default.aspx/Get'; var test; $('#getInstance').click(function () { $.ajax({ url: url, type: 'POST', dataType: 'json', data: JSON.stringify(DTO), contentType: 'application/json; charset=utf-8', success: function (msg) { test = msg; }, error: function (jqXHR, textStatus, errorThrown) { alert(textStatus); alert(errorThrown); } }); });
This works fine as in it connects to the server and gets the data back, with one simple problem. It is treating this request as a cross domain request, therefore using jsonp. The server code is here:
[WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public static MyObject Get(string path) { MyObject foo = new MyObject(); return foo; }
Normally this would not be a problem, except that I am accessing a WebMethod, and it doesnt have the capability to return a jsonp response (meaning it has no way to attach the callback function to the response. Now, if this was a manual response, I could hack it up and attach the parameter, but I am taking advantage of the built-in serialization, so no way to mess around with the response. [URL]
Let me just stress the fact that this code works. The only problem is jQuery treating this request as cross domain. But Why? UPDATE: Well, after many more hours and more testing I have narrowed this issue down to it being a bug in jquery 1.5.1. I did some testing with older versions (all 1.4 versions) and I had no problem, the request was made using JSON, and the response was received successfully. What could be the change they made that would consider this request a CORS?
i am calling a function which is inside Homescroll.ascx.cs from Homescroll.ascx so i wrote on Homescroll.ascx as <% Response.Write(scroll()); %> but all this is in update panel,and i am getting errors. so is their any other way to call function from homescroll.ascx to homescroll.ascx.cs,instead of response.write();
Let me explain better than what the question state. I dynamically generate a KML file from an aspx page and use routing to change the url so I can access myapp.com/mykml.kml and the download starts. I use Response.write() in the aspx page to send the data and it work flawlessly. But there is a zipped version for KML files which is KMZ and I am wondering if I can still use my aspx page to serve a KMZ instead of a KML. Since I do not use a file I cannot "zip" it. Is there a way to zip the stream and output it in the Response.Write()?
I have the following subroutine: Public Sub StartTimeDif() Dim dt As DateTime = Convert.ToDateTime(starttimeInput.Text) Dim dt1 As DateTime = Convert.ToDateTime(endtimeInput.Text) Dim ts As TimeSpan = dt1.Subtract(dt) Response.Write(ts.Minutes) End Sub and I'm trying to pass (ts.minutes) to durationLabel.
In the past I have always worked from the code behind page in ASP.NET and emitting all of my markup from that area.I am now learning MVC and am working in the .ASPX page directly.
Response.Write("<script id=""mycountry3"" language=""Javascript"" src=""http://www.ip2phrase.com/ip2phrase.asp?template=You are from Country: <COUNTRY> ""></script>")
in showfile.aspx, I send the file using Response.OutputStream.Write method. now I get some problem when somebody put this webpage in an IFrame and open in IE, as I checked the code, showfile.aspx is requested twice when clicks the link, and in the second time the cookies of authorization and session Id are missing. I tried to add the p3p header but not working.my question is, is this how the IE designed with iframe? is there anyway to work around?
The variable id is declared and it's value set eralier in the method.When the new window opens it displays the image properly, but the existing page suddenly loses all of it's styling. The links double in size and change font family. Does anyone know a way to retain styling on the calling page?
Error 1 'Response' is an ambiguous reference between 2 references that have a Response.Neither is the one I need,how do i reference the Response that write the file?
I hv a master page nd 3 content pages...my contents of d page r located in the middle of the page...
I have some alert boxes in my page...like this,. response.write(<script>alert('Invalid input')</script>);....
wen the "response.write" is executed. . all my contents of the page are moving to left side of d page and the fonts getting bigger and font style is changed as well . .
Is is possible to write to the http response stream from a dynamically created bitmap using the Response.Write/WriteFile without saving the image to the hard drive?
I am trying to get a control (not a controller -- a subclass of System.Web.UI.WebControls.WebControl), that can be used that I wrote for ASP.NET to work in an ASP.NET MVC environment. Normally, the control does the normal thing, and that works fine
Sometimes it needs to respond by clearing the response, writing an image to the response stream and changing the content type. When you do this, you get an exception "OutputStream is not available when a custom TextWriter is used".
If I were a page or controller, I see how I can create custom responses with binary data, but I can't see how to do this from inside a control's render functions. To simplify it -- imagine I want to make a web control that renders to:
<img src="pageThatControlIsOn?controlImage">
And I know how to look at incoming requests and recognize query strings that should be routed to the control. Now the control is supposed to respond with a generated image (content-type: image/png -- and the encoded image). In ASP.NET, we:
Response.Clear(); Response.OutputStream.Write(thePngData); // this throws in MVC // set the content type, etc Response.End();
How am I supposed to do that in an ASP.NET MVC control?
I want to use response.write to generate a table. but I have a question, the result of table must display on the top of web page. How can I control the location of table? e.g. at the middle or end of web page or starting from number of line.