I'm using the RetsSession to download document Files from an MLS but looks like the content type comes in as "application/pdf;charset=US-ASCII" is there anyway to remove the charset=US-ASCII from the content type ? I should see only application/pdf, OR image/png as content type.
DocFiles tx = new DocFiles (DocFilesId, account);
RetsSession session = new RetsSession(m_LogInUrl);
session.SetUserAgentAuthType(UserAgentAuthType.USER_AGENT_AUTH_RETS_1_7);
var loggedIn = session.Login(m_LogInUser, m_LogInPass);
var documentCount = 1;
ObjectDescriptor obj;
do
{
using (librets.GetObjectRequest request = new GetObjectRequest("Property", "PDF"))
{
request.AddObject("MLS123", documentCount);
GetObjectResponse response = session.GetObject(request);
obj = response.NextObject();
if (obj != null)
{
var ContentType = obj.GetContentType(); // output is = application/pdf;charset=US-ASCII
var description = obj.GetDescription();
var Errorcode = obj.GetRetsReplyCode().ToString();
//<RETS ReplyCode="20403" ReplyText="No such object available for this resource"/>
if (Errorcode == "20403")
{
obj = null;
}
documentCount++;
}
}
} while (obj != null);
Try parsing the ContentType using Microsoft.Net.Http.Headers MediaTypeHeaderValue.Parse: