Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Asp.net Errors on compiling & runtime, Could not load type 'EmailSubscribers' &

Avatar of westdh
westdhFlag for United States of America asked on
.NET ProgrammingASP.NETEmail Servers
4 Comments1 Solution574 ViewsLast Modified:
Asp.net Errors on compiling & runtime, Could not load type 'EmailSubscribers' &  Mail ??

Run time error:

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'EmailSubscribers'.

Source Error:

Line 1:  
Line 2:  <%@ Page language="VB" Debug="true" Inherits="EmailSubscribers" CodeBehind="EmailSubscribers.aspx.vb" AutoEventWireup="false" validateRequest="false" %>
Line 3:  
Line 4:  <html>

Complie errors
Error      4      Could not load type 'EmailSubscribers'.      C:\WebSite2\Annonymous\EmailSubscribers.aspx      2      
Error      5      Overload resolution failed because no accessible 'New' accepts this number of arguments.      C:\WebSite2\Annonymous\EmailSubscribers.aspx.vb      77      25      C:\WebSite2\

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Drawing
Imports System.IO
Imports System.Net
Imports System.Web
Imports System.Net.Mail
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Text

Public Class EmailSubscribers : Inherits System.Web.UI.Page
    Protected RtnHomeButton As System.Web.UI.WebControls.HyperLink
    Protected MyDataGrid As System.Web.UI.WebControls.DataGrid

    ' The Page_Load event handler on this User Control is used to
    ' obtain a DataReader of contact information from the Contacts
    ' table, and then databind the results to a DataGrid
    ' server control.  It uses the ASPNetPortal.ContactsDB()
    ' data component to encapsulate all data functionality.

    Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        If Not IsPostBack Then
            Dim myConnection As New SqlConnection("ASPNETDBConnectionString")
            Dim myCommand As New SqlCommand("SELECT emailID email FROM subscriptions", myConnection)


            Dim dr As SqlDataReader = myCommand.ExecuteReader()

            MyDataGrid.DataSource = dr


        End If
    End Sub

    Private Sub GetSelections_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim rowCount As Integer = 0
        Dim gridSelections As New StringBuilder()

        'Loop through each DataGridItem, and determine which CheckBox controls
        'have been selected.
        For Each DemoGridItem As DataGridItem In MyDataGrid.Items

            Dim myCheckbox As CheckBox = DirectCast(DemoGridItem.Cells(0).FindControl("myCheckbox"), CheckBox)
            If myCheckbox.Checked = True Then
                rowCount += 1
                gridSelections.AppendFormat("The checkbox for {0} was selected<br>", MyDataGrid.DataKeys(DemoGridItem.ItemIndex).ToString())

                'Trace.Write("test:2" + MyDataGrid.DataKeys[DemoGridItem.ItemIndex].ToString());

                Dim myConnection1 As New SqlConnection("ASPNETDBConnectionString")
                Dim myCommand As New SqlCommand("select Email from Pilots Where PilotsID = '" + MyDataGrid.DataKeys(DemoGridItem.ItemIndex).ToString() + "'", myConnection1)


                Dim drn As SqlDataReader = myCommand.ExecuteReader()
                Dim ToEmail As String = DirectCast(drn("Email"), [String])

                If ToEmail <> "" Then

                    Dim Email As New System.Net.Mail.MailMessage(ToEmail)
                    Email.Subject = "Used Vocational Trucks.com - Sale Notices"
                    Email.Body = "To Contact Us:<br>Used Vocational Trucks.com<br>PO Box 503145<br>White City, OR  97503  USA<br>541-690-4735<br>info@usedvocationaltrucks.com<br>www.usedvocationaltrucks.com"
                    Dim mailClient As New System.Net.Mail.SmtpClient()

                    'This object stores the authentication values
                    Dim basicAuthenticationInfo As New System.Net.NetworkCredential("info@usedvocationaltrucks.com", "xxxxxNeedDave's email Paswd")

                    'Put your own, or your ISPs, mail server name onthis next line
                    mailClient.Host = "info@usedvocationaltrucks.com"
                    mailClient.UseDefaultCredentials = False
                    mailClient.Credentials = basicAuthenticationInfo

                End If
            End If

    End Sub

End Class


<%@ Page language="VB" Debug="true" Inherits="EmailSubscribers" CodeBehind="EmailSubscribers.aspx.vb" AutoEventWireup="false" validateRequest="false" %>

   <p>E-Mail Subscribers Posted Sales</p>

	<table border="0" cellspacing="0" cellpadding="0" width="600">
			<td align="left"><b>Send Email to Subscribers</b>(check send mail box)</td>
			<td align="right"><asp:hyperlink id="RtnHomeButton" cssclass="printbutton" NavigateUrl="~/Annonymous/index.aspx"
	<form id="default" method="post" runat="server">

		<P><asp:button id="GetSelections" runat="server" Text="Send Email to Subscribers"></asp:button></P>
		<P><asp:label id="ResultsInfo" runat="server"></asp:label></P>
		<asp:datagrid id="MyDataGrid" runat="server" DataKeyField="Email">
				<asp:TemplateColumn HeaderText="Selected">
						<asp:CheckBox ID="myCheckbox" Checked="True" Runat="server" />
Avatar of guru_sami
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answers