Server Error in '/Hour5' Application.
Hej E.Når jeg køre nedenstående kode:
imports system
imports System.Web.Mail.SmtpMail
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Hour5.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<script runat="server">
public sub btnLogin_Click(byval sender as object, byval e as system.eventargs)
dim objSMTP as new system.web.mail.smtpmail()
objSMTP.send(txtEmail.text, txtEmail.text, "Test SMTP mail", "This is a test mail")
end sub
public sub Button2_click(byval send as object,byval e as system.eventArgs)
dim objSMTP as new System.web.mail.smtpmail()
objSMTP.send(txtEMail.text,txtEMail.text,"Test SMTP Mail", txtMessage.value)
end sub
</script>
<form id="Form1" method="post" runat="server">
<TABLE id="Table1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" cellSpacing="1"
cellPadding="1" width="300" border="1">
<TR>
<TD>E-Mail addresse</TD>
<TD>
<asp:TextBox id="txtEmail" runat="server"></asp:TextBox></TD>
</TR>
<TR>
<TD>Password</TD>
<TD><INPUT type="password"></TD>
</TR>
<TR>
<TD align="center" colSpan="2"><INPUT id="btnLogin" type="button" value="Login"></TD>
</TR>
<tr>
<td>
Message Text
</td>
<td>
<input type="text"
id="txtMessage"
name="txtMessage"
size="50"
RUNAT="server">
</td>
</tr>
<tr>
<td align="middle" colspan="2">
<input type="button"
id="Button2"
runat="server"
value="Server Side HTML Button"
OnServerClick="Button2_Click"
name="Button2">
</td>
</tr>
</TABLE>
</form>
</body>
</HTML>
Så kommer følgende fejl:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30390: 'System.Web.Mail.SmtpMail.Private Sub New()' is not accessible in this context because it is 'Private'.
Source Error:
Line 16: <script runat="server">
Line 17: public sub btnLogin_Click(byval sender as object, byval e as system.eventargs)
Line 18: dim objSMTP as new system.web.mail.smtpmail()
Line 19: objSMTP.send(txtEmail.text, txtEmail.text, "Test SMTP mail", "This is a test mail")
Line 20: end sub
Jeg fandt et tidligere spørgsmål hvor der blev svaret at det var opsætningen as IIS’en som var forket.
Her er et screendump.
www.flash-it.dk/dotnet.jpg
Håber i kan hjælp mig, da jeg ikke selv kan finde ud af hvorfor den kommer og siger at det er ”privat”..?
