bealem
asked on
Set MIME type on .NET web service
Hello there,
I've got a .NET web service written in VB using Visual Studio 2003.
I need to change the MIME type for this one web service.
I know I can change it on IIS, but that will change it for all web services (.asmx files) but I don't want to do that, I need to only change it (programatically) for this one web service.
Any ideas?
Cheers
Mike
I've got a .NET web service written in VB using Visual Studio 2003.
I need to change the MIME type for this one web service.
I know I can change it on IIS, but that will change it for all web services (.asmx files) but I don't want to do that, I need to only change it (programatically) for this one web service.
Any ideas?
Cheers
Mike
ASKER
Hi Max,
Thanks for your response.
Yes, I understand I can do that for ASP.NET web pages (.aspx files) but this is a web service (.asmx files)
There is no "html page" code for a web service, only the "code behind" vb code.
Where would I put your example in the .asmx file?
Mike
Thanks for your response.
Yes, I understand I can do that for ASP.NET web pages (.aspx files) but this is a web service (.asmx files)
There is no "html page" code for a web service, only the "code behind" vb code.
Where would I put your example in the .asmx file?
Mike
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
bealem,
In essence it means you need to set Response.ContentType to whatever you need.
Regards,
Max.
In essence it means you need to set Response.ContentType to whatever you need.
Regards,
Max.
Glad to have been helpful :)
Regards,
Max.
Regards,
Max.
ASKER
Max,
That link you provided got me going in the right direction.
I was trying to add the Context.Response. commands to my function in my web service, but it wouldn't work, would return what I wanted, then the XML for the web service!
I managed to get round it by changing the functon to a sub:
<WebMethod()> _
Public Sub Something(ByVal strLocation As String)
and replacing the rertrun from the end of the original function to this:
Context.Response.ClearHead ers()
Context.Response.ContentTy pe = "application/*+xml"
Context.Response.Write(str bXML.ToStr ing)
Thanks for you help in getting me going in the right direction.
Cheers
Mike
That link you provided got me going in the right direction.
I was trying to add the Context.Response. commands to my function in my web service, but it wouldn't work, would return what I wanted, then the XML for the web service!
I managed to get round it by changing the functon to a sub:
<WebMethod()> _
Public Sub Something(ByVal strLocation As String)
and replacing the rertrun from the end of the original function to this:
Context.Response.ClearHead
Context.Response.ContentTy
Context.Response.Write(str
Thanks for you help in getting me going in the right direction.
Cheers
Mike
You can set the mimetype on each page in your application by doing the following:
<%@ Page Language="VB" ContentType="application/x
Where application/xhtml+xml would be changed to whatever mimetype you need.
Regards,
Max.