Strange things are happening when I try to attach an input file to an email from an aspx form.

M

Mark Sandfox

When i run this from the server all works well (except the constant error
messages regarding the hoverbuttons), but when I run this page from my local
machine i get the following error message:


Server Error in '/mm' Application.
----------------------------------------------------------------------------
----

Runtime Error
Description: An application error occurred on the server. The current custom
error settings for this application prevent the details of the application
error from being viewed remotely (for security reasons). It could, however,
be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable
on remote machines, please create a <customErrors> tag within a "web.config"
configuration file located in the root directory of the current web
application. This <customErrors> tag should then have its "mode" attribute
set to "Off".

<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>

Notes: The current error page you are seeing can be replaced by a custom
error page by modifying the "defaultRedirect" attribute of the application's
<customErrors> configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>



I also cannot figure out how to turn on local debuging so i can see where
the error is.

The objective here is simple collect data from a user and send it to me via
an email (including an attached file .jpg).


Here is an excerpt of my code:

objMailMessage = New MailMessage
objMailMessage.From = tbContactEmail.Text
objMailMessage.To = "(e-mail address removed)"
objMailMessage.Subject = "From the FREE Listings Form of
MoreMulligans.com"
objMailMessage.Body = swHtmlBody.ToString
if Not IsNothing (iPhoto.PostedFile) then
objMailAttachment = New MailAttachment(iPhoto.PostedFile.FileName)
objMailMessage.Attachments.Add(objMailAttachment)
end if
objMailMessage.BodyFormat = MailFormat.HTML


SmtpMail.Send( objMailMessage )
Response.Redirect( "thank_you.htm" )
end if
End Sub
</script>

........

<input id="iPhoto" type="file" runat="server" size="20">


Thank you in advance for your help.
 
K

Kevin Spencer

I also cannot figure out how to turn on local debuging so i can see where
the error is.

The error message has instructions in it.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top