help!! ResponseSoapContext.Current is always null

N

Nick

below is the code. I don't really see anything wrong with it, but the
ResponseSoapContext.Current is always null. If anyone know how to
solve this please let me know. thanks a lot.

[WebMethod]
public string GetFile(string file)
{
// Get the SoapContext for the response message
SoapContext myContext = ResponseSoapContext.Current;

// String that represents the file name and path for the attachment.
string filePath = Server.MapPath(file);

// Create a new DIME attachment using the the file name and
// specifying the encoding of the attachment using the MIME media
// type of image\jpeg.
DimeAttachment dimeFile = new DimeAttachment("image/gif",
TypeFormatEnum.MediaType, filePath);

// Generate a GUID-based URI reference for the attachment object
// and assign in to the ID property of the DIME record.

dimeFile.Id = "uri:" + Guid.NewGuid().ToString();

// Add the new DimeAttachment object to the SoapContext object.
myContext.Attachments.Add(dimeFile);

return file;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top