Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/01/2013, 09:21
Avatar de fbirrer
fbirrer
 
Fecha de Ingreso: enero-2006
Ubicación: Santiago de Chile
Mensajes: 329
Antigüedad: 18 años, 3 meses
Puntos: 0
Error al adjuntar archivos

hola todos

Estoy adjuntando un documento que convierto en memorystrem. El problema que cuando me llega el adjunto me llega con un peso de 0 bits,

¿Como puedo resolver esto?

Este es el codigo que tengo

Código ASP:
Ver original
  1. If archivoAdjunto.Trim <> "" Then
  2.             'Using memoryStream As New MemoryStream()
  3.             Dim memoryStream As New MemoryStream()
  4.             Dim contentAsBytes As Byte() = Encoding.UTF8.GetBytes(archivoAdjunto)
  5.             MemoryStream.Write(contentAsBytes, 0, contentAsBytes.Length)
  6.  
  7.             ' Set the position to the beginning of the stream.
  8.             'memoryStream.Seek(0, SeekOrigin.Begin)
  9.  
  10.             ' Create attachment
  11.             Dim contentType As New System.Net.Mime.ContentType
  12.             contentType.Name = archivoAdjunto.Substring(archivoAdjunto.LastIndexOf("\") + 1)
  13.             contentType.MediaType = "application/pdf"
  14.  
  15.             ' Add the attachment
  16.             Mensaje.Attachments.Add(New Attachment(memoryStream, contentType))
  17.             'End Using
  18.         End If
  19.  
  20.  
  21.         'Asignar el servidor de correo electronico
  22.         'SmtpMail.SmtpServer = "localhost"
  23.         SmtpMail.Host = "**********.********.corp"
  24.  
  25.         'Finalmente, enviar el mensaje.
  26.         Try
  27.             SmtpMail.Send(Mensaje)


Asi es como llega al correo:





Me da este error al intentarlo abrir



Agradecere ayuda,
__________________
Desde Santiago de Chile
Grupo Universite
Información sobre los Institutos Chilenos de Educación
www.universite.cl