C#의 memorystream과 관련된 큰 문제가 있습니다. 내 응용 프로그램은 전자 메일의 html을 가져오고 첨부 파일 인 이미지의 src 값을 파싱하고 해당 src 값을 다른 것으로 변경합니다. 그건 완벽하게 잘 작동합니다. 문제는 내가 그 결과 HTML을 셰어 포인트 목록에 저장해야한다는 것입니다. 그리고 그것은 그렇습니다. 그러나 sharepoint 목록에있는 내용을 볼 때 전자 메일을 보여주지는 못합니다. 단지 일부분 일뿐입니다. 메모리 스트림이 내용을 전혀 저장하지 못하거나 결과를 저장하고있는 문자열에 메모리 스트림이 저장하고있는 내용을 저장할 수있는 충분한 용량이 있는지 알 수 없습니다. 누구든지 아이디어가 있으면 게시하십시오!memorystream이 모든 내용을 저장하지 않음
string SRC = "";
int indice = 0;
//Console.WriteLine(body);
HtmlDocument email = new HtmlDocument();
email.LoadHtml(body);
Console.WriteLine("bodylength: " + body.Length);//original length
foreach (HtmlNode img in email.DocumentNode.SelectNodes("//img"))
{
SRC = img.GetAttributeValue("src", null);
for (int i = 0; i < contentIDS.Count; i++)
{
if (SRC.Equals(contentIDS[i].ToString()))
{
//Console.WriteLine("contents" + contentIDS[i].ToString());
indice = i;
break;
}
}
img.SetAttributeValue("src", urls[indice].ToString());
Console.WriteLine(img.GetAttributeValue("src", null));
}
//se guarda en memoria los cambios hechos en el html y se retorna e tipo string el html con los cambios realizados
MemoryStream memoryStream = new MemoryStream();
email.Save(memoryStream);
//memoryStream.SetLength(body.Length);
memoryStream.Seek(0, System.IO.SeekOrigin.Begin);
StreamReader streamReader = new StreamReader(memoryStream);
return streamReader.ReadToEnd();//this is then store in a string when i call this method. The lenght of that string is much much smaller than the original one.
아마도 using() 블록 내부에서 MemoryStream의 사용을 래핑 해보십시오. – PeskyGnat
단순히 HTML 렌더링 문제가 아닌 것이 확실합니까? 페이지 소스를 보셨습니까? 전체 전자 메일이 있습니까? – Oded
"C#"등을 제목에 추가하지 마십시오. 그것이 바로 태그가있는 것입니다. –