Last post Jul 14, 2006 03:01 AM by masterslave
Jul 10, 2006 08:04 AM|masterslave|LINK
the problems start happening when i redirect - i need to somehow end
the response but not with Response.End because it doesn't allow it to
get to the Redirect statement and if i use something like
Response.Close or Response.Clear it outputs "Object moved to here" text
to the file instead of the page content.
here's the code:
Dim path As String = Server.MapPath(fileName)
Response.ContentType = "application/ms-excel"
"inline;filename=" & fileName)
'End the HTML document
Response.Filter = New ResponseFilter(Response.Filter, path)
Response.Redirect("SendEmail.aspx?savepath=" & path)
Jul 12, 2006 11:47 PM|TonyBunce|LINK
Jul 13, 2006 03:14 AM|masterslave|LINK
that's the thing, i don't want to display the file in browser, just want to send the generated file as an email attachment
hopefully, having sent that email i can redirect the user to another page or something and that's where the problem comes in...
Jul 13, 2006 10:20 AM|TonyBunce|LINK
Is this an asp.net 2.0 site?
If so you can do something like this:
Dim msgMail as MailMessage = new MailMessage()
Dim MailObj As New SmtpClient("mail.YourDomain.com")
msgMail.To = "email@example.com"
msgMail.From = "someoneelse@differentaddress."
msgMail.Subject = "See Attachment"
msgMail.BodyFormat = MailFormat.Text
msgMail.Body = "Excel File Attached"
Jul 14, 2006 03:01 AM|masterslave|LINK
thanks for your reply tony! no, it's not asp.net 2.0 website.
the problem is that i need to send the file generated with response.filter and i've only been able to successfully save it if i do response.end otherwise if i do redirect or something it outputs "Object moved to here" to the file only.
and i don't want to send the output to the client which what i'd do with response.end