Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
343 views
in Technique[技术] by (71.8m points)

c# - How can i return raw bytes from ASP.NET web service?

If the WebMethod returns string it gets serialized to xml.

I want to return byte[] with responding ContentType - can I also specify it?.

Can it be done in ASP.NET web service web method?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

ASMX web services use SOAP and the content type will always be application/soap+xml and the content represent xml. Even if you return a byte[] from your method this array will be base64 encoded into the soap body.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...