Click here to Skip to main content
15,891,136 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Run an EXE Pin
Christian Graus16-Jun-09 16:15
protectorChristian Graus16-Jun-09 16:15 
GeneralRe: Run an EXE Pin
madancode16-Jun-09 22:58
madancode16-Jun-09 22:58 
QuestionHow 2 use DataContractJsonSerializer Pin
paliwal vipin16-Jun-09 1:59
paliwal vipin16-Jun-09 1:59 
AnswerRe: How 2 use DataContractJsonSerializer Pin
Abhishek Sur16-Jun-09 5:52
professionalAbhishek Sur16-Jun-09 5:52 
QuestionChange text in a Messagebox button Pin
Ratheesh_v16-Jun-09 1:22
Ratheesh_v16-Jun-09 1:22 
AnswerRe: Change text in a Messagebox button Pin
Manas Bhardwaj16-Jun-09 2:11
professionalManas Bhardwaj16-Jun-09 2:11 
GeneralRe: Change text in a Messagebox button Pin
Baran M16-Jun-09 2:45
Baran M16-Jun-09 2:45 
QuestionProblem when creating email with In-memory attachment Pin
ipsario16-Jun-09 0:56
ipsario16-Jun-09 0:56 
I´m building a functionality where the website will send emails with attached Excel-files. For some reason this does not work and I have tried to pinpoint the error. The code below runs perfect as long as the string does not exceed 2340 in length. I have been trying for two days to find out why I can not have longer strings than 2340. Any help would be much appreciated.


Using memoryStream As New MemoryStream()
   Dim sData As String = "" ' getDataFromFile()

   For i = 1 To 2342
     sData += "A"
   Next

   Dim contentAsBytes As Byte() = Encoding.UTF8.GetBytes(sData)

   memoryStream.Write(contentAsBytes, 0, contentAsBytes.Length)
   ' Set the position to the beginning of the stream.
   memoryStream.Position = 0

   ' Create attachment
   Dim contentType As New ContentType()
   contentType.MediaType = MediaTypeNames.Application.Octet
   contentType.Name = "attachment.xls"

   Dim attachment As New Attachment(memoryStream, contentType)
                    
   ' Add the attachment
   message.Attachments.Add(attachment)

   ' Send Mail via SmtpClient
   smtpClient.Send(message)
End Using


Error Message:
System.Net.Mail.SmtpException was unhandled by user code<br />
  Message="Failure sending mail."<br />
  Source="System"<br />
  StackTrace:<br />
       at System.Net.Mail.SmtpClient.Send(MailMessage message)    at _SendMail.btnSendMail_Click(Object sender, EventArgs e) in E:\Visual Studio 2008\XlsMail\Default.aspx.vb:line 55    at System.Web.UI.WebControls.Button.OnClick(EventArgs e)    at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)    at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)    at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)    at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)<br />
  InnerException: System.IO.IOException<br />
       Message="Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond."<br />
       Source="System"<br />
       StackTrace:<br />
            at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)    at System.Net.DelegatedStream.Read(Byte[] buffer, Int32 offset, Int32 count)    at System.Net.BufferedReadStream.Read(Byte[] buffer, Int32 offset, Int32 count)    at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)    at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)    at System.Net.Mail.CheckCommand.Send(SmtpConnection conn, String& response)    at System.Net.Mail.DataStopCommand.Send(SmtpConnection conn)    at System.Net.Mail.SmtpConnection.OnClose(Object sender, EventArgs args)    at System.Net.ClosableStream.Close()    at System.Net.Mail.MailWriter.Close()    at System.Net.Mail.SmtpClient.Send(MailMessage message)<br />
       InnerException: System.Net.Sockets.SocketException<br />
            ErrorCode=10060<br />
            Message="A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"<br />
            NativeErrorCode=10060<br />
            Source="System"<br />
            StackTrace:<br />
                 at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)<br />
            InnerException: 


Glenn
Questiondata set break through loop in vb.net Pin
prabhat kumar mokama16-Jun-09 0:50
prabhat kumar mokama16-Jun-09 0:50 
AnswerRe: data set break through loop in vb.net Pin
Christian Graus16-Jun-09 16:28
protectorChristian Graus16-Jun-09 16:28 
AnswerRe: data set break through loop in vb.net Pin
souravghosh1816-Jun-09 22:07
souravghosh1816-Jun-09 22:07 
QuestionSQLBulkCopy & Adding values [modified] Pin
munklefish16-Jun-09 0:43
munklefish16-Jun-09 0:43 
AnswerRe: SQLBulkCopy & Adding values Pin
himanshu256116-Jun-09 1:32
himanshu256116-Jun-09 1:32 
GeneralRe: SQLBulkCopy & Adding values Pin
munklefish16-Jun-09 1:50
munklefish16-Jun-09 1:50 
GeneralRe: SQLBulkCopy & Adding values Pin
himanshu256116-Jun-09 21:44
himanshu256116-Jun-09 21:44 
GeneralRe: SQLBulkCopy & Adding values Pin
munklefish16-Jun-09 23:40
munklefish16-Jun-09 23:40 
Questionwhat mean this write Pin
jason_mf16-Jun-09 0:09
jason_mf16-Jun-09 0:09 
AnswerRe: what mean this write Pin
pompeyboy216-Jun-09 0:38
pompeyboy216-Jun-09 0:38 
AnswerRe: what mean this write Pin
Baran M16-Jun-09 0:46
Baran M16-Jun-09 0:46 
Answerthe force strong in you is Pin
munklefish16-Jun-09 0:51
munklefish16-Jun-09 0:51 
AnswerRe: what mean this write Pin
Christian Graus16-Jun-09 18:32
protectorChristian Graus16-Jun-09 18:32 
QuestionFormat GridView Pin
yesu prakash15-Jun-09 23:48
yesu prakash15-Jun-09 23:48 
AnswerRe: Format GridView Pin
Baran M15-Jun-09 23:57
Baran M15-Jun-09 23:57 
AnswerRe: Format GridView Pin
Abhijit Jana16-Jun-09 0:02
professionalAbhijit Jana16-Jun-09 0:02 
AnswerRe: Format GridView Pin
Christian Graus16-Jun-09 0:04
protectorChristian Graus16-Jun-09 0:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.