WCF / ASMX :: Content Type Text / Html Of The Response Message Does Not Match The Content Type Of The Binding

May 7, 2010

I'm getting this message when going to a web app that accesses my service.

"The content type text/html of the response message does not match the content type of the binding (text/xml; charset=utf-8)..."

The thing is, it happens once in a while even when no changes have been made to the service or the web app. And I can make it go away most of the time by going directly to the .svc?wsdl page in my browser and then coming back to the web app.

View 2 Replies


Similar Messages:

How To Set A Default Content-type Of Text / HTML In Web.config

May 4, 2010

I'd like to set the default content-type for web pages in my ASP.NET MVC application to text/html.

I know this can be done by adding a ContentType="text/html" to all of my <%Page%> elements, but I'd prefer to use the web.config instead. How can I do that?

Edit: I know that "text/HTML" is the ASP.NET default, but for unknown reasons Opera still tries to parse my web site as XHML unless I explicitly set the content-type in my <%Page%> element.

View 4 Replies

Setting Content - Type Of Empty Response In MVC

Dec 27, 2010

In order to support a legacy application that's in the field, I need my ASP.NET MVC app to return an empty response that also has a Content-Type. One of IIS, ASP.NET, or ASP.NET MVC is removing my Content-Type when I send back a null response. Is there any way around this? (While not requiring an empty response with a set Content-Type would obviously be the ideal solution, the clients are already out there, and many of them cannot be upgraded.)

EDIT: Since there was a request for code: I'm proxying the request from the new web application to the one that older clients rely on. To do this, I have a subclass of ActionResult, called LegacyResult, that you can simply return for those methods that need to be handled by the old software. This is the relevant part of its code:

public override void ExecuteResult(ControllerContext context)
{
using (var legacyResponse = GetLegacyResponse(context))
{
var clientResponse = context.HttpContext.Response;
clientResponse.Buffer = false;
clientResponse.ContentType = legacyResponse.ContentType; /* Yes, I checked that legacyResponse.ContentType is never string.IsNullOrEmpty */
if (legacyResponse.ContentLength >= 0) clientResponse.AddHeader("Content-Length", legacyResponse.ContentLength.ToString());
var legacyInput = legacyResponse.GetResponseStream();
using (var clientOutput = clientResponse.OutputStream)
{
var rgb = new byte[32768];
cb;
while ((cb = legacyInput.Read(rgb, 0, rgb.Length)) > 0)
{
clientOutput.Write(rgb, 0, cb);
}
clientOutput.Flush();
}
}
}

If legacyInput has data, then Content-Type is set appropriately. Otherwise, it's not. I can actually kluge the old backend to send an empty v. non-empty response for exactly the same request, and observe the difference in Fiddler.

EDIT 2: Poking around with Reflector reveals that, if headers have not been written at the time that HttpResponse.Flush is called, then Flush writes out the headers itself. The problem is that it only writes out a tiny subset of the headers. One of the missing ones is Content-Type. So it seems that, if I can force headers out to the stream, I can avoid this problem.

View 1 Replies

Getting The Full Path Of The File Uploaded Using HTML Inputfile Type To Read The Content Of The File?

May 20, 2010

I would like to use HTML input file type in my aspx page to allow user to browse for a excel file and then read the content of the excel sheet programmatically.If I want to read the excel sheet I need the full path of the file to connect to the excel sheet using asp.net.I do not understand how can I get the full path of the file.I know I can get the filename using postedFile.FileName property.But I need the full path of the file.

View 2 Replies

WCF / ASMX :: Change Response Type In WSE 3.0 Service

Mar 24, 2011

I inherited a old WSE 3.0 service. I am building an ASP.NET client for it. It is returning a MTOM response so my client is complaining. Does anyone know of a way to change the response type to XML? Or change my client to accept MTOM? I just want this crap to work.

View 2 Replies

MVC :: Content Type Not Recongnized?

Jun 18, 2010

I am uploading a file on a MVC Action. The file I am uplading is a PDF document.However, on the controller I get "application/octet-stream" as ContentType instead of "application/pdf".Do I need to install Adobe Acrobat Reader on the system so that a PDF file is recongnized?

View 4 Replies

Web Forms :: Set HttpWebResponse Content Type?

Sep 22, 2010

I need to display pdf using my web application each time user clicks on image icon.On clicking the image, I will call another web application(imageUrl) which will open up the pdf.Please find the code below:

HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(imageUrl);
Request.UserAgent =
"Client Cert Sample";"

[code]...

View 3 Replies

Getting Content-type In .ashx From Uploadify?

Nov 12, 2010

I able to upload my file through uploadify + .ashx, but the problem is I always get ContentType = application/octet-streamLets say I upload an image, I expected to return me "image/pjpeg", but it always return "application/octet-stream" no matter what file I uploaded.how to get the correct contentType in .ashx

View 1 Replies

Uploaded File Content Type Not Correct?

Jan 6, 2011

I have a simple upload page using the html file element. I choose a .pdf file to upload and when I inspect the Content type of the file when it goes to server the value is "application/msword" instead of "application/pdf"

View 1 Replies

MVC :: Change Page Content Type At Runtime?

Oct 25, 2010

I am working in asp.net MVC & on the view has to show both json & xml content depending on some condition.

I have to change the content type of the page at runtime ie,

if the condition for json is fulfilled then set page contenttype = "text/json"

&

if the condition for xml is fulfilled then set page contenttype = "text/xml".

I have tried setting default content type on view as

<%
@
Page
Language="C#"
Inherits="System.Web.Mvc.ViewPage"
ContentType="text/json"%>

& in controller class if xml condition is fulfilled then chnage it like :

this.Response.Clear;

this.Response.ContentType = "text/xml";

BUT it didn't work for me .

View 2 Replies

WCF / ASMX :: Parser Error Message: Could Not Create Type 'Service'

Sep 24, 2010

My web service works fine on my local machine but when i put it on the server it throw this error:

Parser Error Message: Could not create type 'Service'.

I don't know how to fix this.

View 1 Replies

Content Type When Serving A File In A Generic Handler?

Dec 10, 2010

I'm busy writing a handler to serve various documents for download or presentation in web forms pages. The documents range from various image formats, to PDF, to MS Office documents, to generic binaries. My basic draft of the download process is as below:

[code]....

However, I have some misgivings about lumping all documents together as application/octet-stream, and I would prefer, if feasible, to use a more specific content type per document type. I have a DB table for document types where I could store this. Am I going in the right direction, and if so, where can I find a suitable starting list of content types for document types?

View 1 Replies

Web Forms :: How To Get Content (MIME) Type Of Uploaded File

Jul 22, 2013

When inserting a binary file do you know what will be the correct content type for extensions like .txt or .gif or others not in your sample? Is there a list of correct content types?

View 1 Replies

Why Does IIS7 Ignore Content-type Header When Use Stream Files

Feb 9, 2010

I have a simple web site with two pages. One displays a list of files, and the other streams a file when it's clicked in the list. All was fine in production for 6 months, but now I have to move the site to Windows 2008/IIS7. I have it mostly working, but the files don't open properly (in Firefox) because my content-type header is being ignored. On the production site (IIS6) the headers are (using Fiddler):

HTTP/1.1 200 OK
Date: Tue, 09 Feb 2010 16:00:51 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Content-Disposition: attachment; filename="myfile__foo.pdf"
Content-Length: 236841
Cache-Control: no-cache, no-store
Pragma: no-cache
Expires: -1
Content-Type: application/octet-stream

but on the test IIS7 server I get:

HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 236841
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
Content-Disposition: attachment; filename="myfile__foo.pdf"

Fiddler also reports a protocol violation and says "Content-length mismatch: Response Header claimed 236841 bytes, but server sent 238378 bytes."

My code looks like this:

[code]....

View 1 Replies

VS 2010 FTP Error - Cannot Send Content Body With This Verb-type

Aug 2, 2011

I have some code which I had working fine as below but now for some reason it throws the error "Cannot send a content-body with this verb-type".

Code:
try {
String destinationPath = ConfigurationManager.AppSettings["HostedPath"].ToString();
String sourcePath = ConfigurationManager.AppSettings["InternalPath"].ToString();
String destinationFolder = destinationPath + "/" + vendor;
String sourceFolder = sourcePath;

[Code] ....

Now I googled the error and found replies as below and changed the request stream lines in the above to the commented out response streams, this no longer throws the error but now no longer copies the file to the ftp site?

[URL] ....

View 2 Replies

WCF / ASMX :: Compiler Error Message: BC30002: Type 'WSQSPExport.OrderImport' Is Not Defined

Jul 22, 2010

I added a web reference to a web service to my web project. I can add an instance of the web service in my code and everything appears to work fine. But if I try to debug my code I get a complie error stating that the Type is not defined. What am I doing wrong?

Description: An error occurred during the compilation of a resource required to service this request. review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30002: Type 'WSQSPExport.OrderImport' is not defined.

Source Error:

[Code]....

Line 336: Dim boolResult As Boolean = True
Line 337: Dim strException As String
Line 338: Dim objQSPExport As New WSQSPExport.OrderImport
Line 339: Dim reader As XmlReader
Line 340: Dim sr As System.IO.StreamReader
Source File: F:WebsxxxFarmsxxxWebApp_Codecls_ExportQSP.vb Line: 338

View 2 Replies

MVC :: Want To Return A Response With Type Text/plain And Status Code 404?

Jul 26, 2010

I want to return a response with type text/plain and status code 404. How do I do that? I've found that ContentResponse allows for setting response type but how do I set response status code?

View 2 Replies

Web Forms :: Remove HTML Content And New String In The Response Object?

Feb 22, 2010

How can I remove the html content and add new string to the Response object. If I use the Respose.Write method the page contains the string, but while taking the view source option from browser it will display some html tag like Doctype, head, body etc. My requirement is only the string should be displayed in the source.

View 2 Replies

AJAX :: Change The FileUploader Content Color If The File Type Is Invalid?

Aug 13, 2010

I'm using an AsyncFileUploader and I want to check if the uploaded file is of valid type (e.g. jpg, gif, png, etc...) and if not the AsyncFileUploader should be colored in Red (like ErrorbackColor setting to Red)

Is this possible either using Javascript or FileUploader events?

View 3 Replies

Binding Sql Server Content To Droplist Value Content

Mar 15, 2011

I want to bind data from SQL server to a dropdownlist. I have found out how to bind the content very simple: I have an array named mat, which I fill with data from this db-call: vb Code:

mat = GetData(clsDbInfo1.GetMaterialer(Session("language"), Session("sId")).Tables(0), Session("language"))

and then I bind the data to the droplist here:

vb Code:
For Each itemMat In mat lstMat.Items.Add(itemMat) Next

But here is my question: How do I bind value content to the dropdownlist just like:

vb Code:
Dim lst0 As New ListItem("Test0", 0) lstMat.Items.Add(lst0)Dim lst1 As New ListItem("Test1", 1) lstMat.Items.Add(lst1)

How do I do that? I have an array including the value content named matId, I want to add the content in the For-Each loop, is that possible??

View 1 Replies

Web Forms :: Couldn't Load Type 'Presentation.CompanyWeb' When Loading Content Page

Jul 23, 2010

I have a solution which has the following structure:

Solution
-Business Entity(project)
-Business Rules(project)
-DataAccess(project)
-Presentation(project)
-ClientBin
-Images
-Login(contains aspx pages, mastpage)
etc

Everything works absolutly fine in dev, but when I move the solution to IIS 7, I get this error! CompanyWeb is the masterpage, which is located in the login directory. Here is the page directive for login.aspx, which is the offending page

<%
@
Page
Title=""
Language="vb"
AutoEventWireup="false"
MasterPageFile="CompanyWeb.master"
CodeBehind="login.aspx.vb"
Inherits="Presentation.login" %>....................

View 1 Replies

Web Forms :: Loading HTML Content Data Dynamically Into Placeholders In Content Pages

Jan 30, 2010

I will be getting data through wcf service coming form commerce server (instead of DB). Data which is coming will be in the form big html content with all html tags or may be a single line sentence. I should display this dynamic data into the placeholder in the content page (master content page). I have been trying but not able to load when the data is in the form of HTML page. html content or may be single lline of senetence.

View 3 Replies

LINQ Group By And Compare Date Error Message - The Conversion Of A Char Data Type To A Datetime Data Type

Jan 27, 2011

I have the following:

[code]....

I keep getting this error:

Message = "The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value."

What i'm trying to do is group by ContentObjectId and then get StartDate that is greater than today.

I'm using entity framwork and MS SQL2008

View 2 Replies

C# - Content Page Dynamic Content Comes Out At The Top Of The HTML Output

Feb 25, 2011

I'm very new to ASP.net. I have a c# content page, in which I want to inset this code half way down within the HTML:

<%
HttpResponse r = Response;
r.Write(HttpContext.Current.Request.ServerVariables["SERVER_NAME"]);
%>

But when I view the page, this content comes out first, before even the tag.

how to get this code inline instead?

View 5 Replies

WCF / ASMX :: Soap Response Does Not Match With TCPMon Tool?

Feb 3, 2011

When I call a webservice function through WSDL, my response when catched through application does not match with TCPMon tool. Is there a way that I can catch the response before it even reaches the application.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved