09. april 2003 - 11:19Der er
10 kommentarer og 1 løsning
jeg må ikke sende mail?
Hej med jer....
Jeg prøver at sende en mail fra IIS SMTP.
Får den error her i hovedet:
Access is denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access is denied.
The ASP.NET process is not authorized to access the requested resource. For security reasons the default ASP.NET process identity is '{machinename}\ASPNET', which has limited privileges. Consider granting access rights to the resource to the ASP.NET process identity.
To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the "{machinename}\ASPNET" user. Highlight the ASP.NET account, and check the Write box in the Allow column.
Men som udgangs punkt skal du ikke(i lang de fleste tilfælde) bruge din egen SMTP server til at sende med ! Du skal som regel bruge din udbyders SMTP.....Hvordan ser din kode ud ?
Sub btnContact_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim newMail As New MailMessage() newMail.To = "min@mail.dk" newMail.From = "domain.dk" newMail.Subject = "Fra: " & txtNavn.Text & " med email: " & txtEmail.Text newMail.Body = txtWord.Text SmtpMail.Send(newMail)
pnlMail.Visible = False
If Not txtNavn.Text = String.Empty AndAlso Not txtEmail.Text = String.Empty Then lblMailSend.Text = "<center><br/><br/><br/>Deres email er nu blevet afsendt.<br/><br/>De hører fra os snarest</center>" lblMailSend.Font.Bold = True Else lblMailSend.Text = "<center><br/><br/><br/>Mailen blev ikke sendt!</center>" lblMailSend.Font.Bold = True lblMailSend.ForeColor = Color.Red End If End Sub
Private Sub SendMail() Dim newMail As New MailMessage() newMail.To = "mail@domain.dk" newMail.Bcc = "test1@domain.dk;test2@domain.dk;test3@domain.dk" newMail.From = "domain.dk" newMail.Subject = "Fra: " & txtNavn.Text & " med email: " & txtEmail.Text newMail.Body = txtWord.Text SmtpMail.Send(newMail) End Sub
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.