By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,572 Members | 964 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,572 IT Pros & Developers. It's quick & easy.

Help on contact page

P: n/a
I designed a "contact_us" page in visual web developer 2005 express along
with EW2 after viewing tutorials on asp.net's help page. Features work like
they should, but I cannot figure out how to send contact info to email or
data base when the "send" button is pressed. I've watched the tutorials over
& over again. I just can't get it.
Link: http://www.syfloristonline.zipa.com/contact_us.aspx.
Need help
Oct 31 '08 #1
Share this Question
Share on Google+
12 Replies


P: n/a
Have you ever used the database features of ASP.NET before (ADO.NET and the
System.Data namespace)? If you have, then you basically just need to do that
same type of thing in the Click event of your send button. If you want the
info sent as an email, take a look at the System.Net and System.Net.Mail
namespace. Some of the classes you are likely to use are MailAddress,
SmtpClient, and MailMessage. I'm sure there are many basic examples out
there, so look for one of the examples (videos may help sometimes, but
seeing a complete code example is sometimes better, since that's what you
want to learn how to do) and see if that helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:27**********************************@microsof t.com...
>I designed a "contact_us" page in visual web developer 2005 express along
with EW2 after viewing tutorials on asp.net's help page. Features work
like
they should, but I cannot figure out how to send contact info to email or
data base when the "send" button is pressed. I've watched the tutorials
over
& over again. I just can't get it.
Link: http://www.syfloristonline.zipa.com/contact_us.aspx.
Need help

Oct 31 '08 #2

P: n/a
I've never used the database features yet, but I am going to try and see what
I can do. I'm still trying to learn it as quick as possible. If I see it once
I usually I get it, but there is something I'm missing. I'll keep trying.
Thanks

"Nathan Sokalski" wrote:
Have you ever used the database features of ASP.NET before (ADO.NET and the
System.Data namespace)? If you have, then you basically just need to do that
same type of thing in the Click event of your send button. If you want the
info sent as an email, take a look at the System.Net and System.Net.Mail
namespace. Some of the classes you are likely to use are MailAddress,
SmtpClient, and MailMessage. I'm sure there are many basic examples out
there, so look for one of the examples (videos may help sometimes, but
seeing a complete code example is sometimes better, since that's what you
want to learn how to do) and see if that helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:27**********************************@microsof t.com...
I designed a "contact_us" page in visual web developer 2005 express along
with EW2 after viewing tutorials on asp.net's help page. Features work
like
they should, but I cannot figure out how to send contact info to email or
data base when the "send" button is pressed. I've watched the tutorials
over
& over again. I just can't get it.
Link: http://www.syfloristonline.zipa.com/contact_us.aspx.
Need help


Nov 1 '08 #3

P: n/a
I felt the same way when I first started learning .NET (They didn't teach us
much in the one course I took). But a book that I bought, which probably
tought me more than any other individual resource, is:

ASP.NET 2.0 Unleashed by Stephen Walther
http://www.informit.com/store/produc...sbn=0672328232

There are versions of the book for the other versions of ASP.NET as well,
but one of the most wonderful things about the author is that the book is
example-oriented with complete examples. The author completely explains
every example, and the code comes on a CD in both VB.NET and C#. I think the
example-oriented style will help you a lot, it definitely helped me.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:88**********************************@microsof t.com...
I've never used the database features yet, but I am going to try and see
what
I can do. I'm still trying to learn it as quick as possible. If I see it
once
I usually I get it, but there is something I'm missing. I'll keep trying.
Thanks

"Nathan Sokalski" wrote:
>Have you ever used the database features of ASP.NET before (ADO.NET and
the
System.Data namespace)? If you have, then you basically just need to do
that
same type of thing in the Click event of your send button. If you want
the
info sent as an email, take a look at the System.Net and System.Net.Mail
namespace. Some of the classes you are likely to use are MailAddress,
SmtpClient, and MailMessage. I'm sure there are many basic examples out
there, so look for one of the examples (videos may help sometimes, but
seeing a complete code example is sometimes better, since that's what you
want to learn how to do) and see if that helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:27**********************************@microso ft.com...
>I designed a "contact_us" page in visual web developer 2005 express
along
with EW2 after viewing tutorials on asp.net's help page. Features work
like
they should, but I cannot figure out how to send contact info to email
or
data base when the "send" button is pressed. I've watched the tutorials
over
& over again. I just can't get it.
Link: http://www.syfloristonline.zipa.com/contact_us.aspx.
Need help



Nov 1 '08 #4

P: n/a
I am lost. I cannot find info on what to do next on my web page. I have the
form completed on the contact us page, but have no idea how to connect to the
database or send the form to an email. I feel stupid. Can it be this hard?

"Nathan Sokalski" wrote:
I felt the same way when I first started learning .NET (They didn't teach us
much in the one course I took). But a book that I bought, which probably
tought me more than any other individual resource, is:

ASP.NET 2.0 Unleashed by Stephen Walther
http://www.informit.com/store/produc...sbn=0672328232

There are versions of the book for the other versions of ASP.NET as well,
but one of the most wonderful things about the author is that the book is
example-oriented with complete examples. The author completely explains
every example, and the code comes on a CD in both VB.NET and C#. I think the
example-oriented style will help you a lot, it definitely helped me.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:88**********************************@microsof t.com...
I've never used the database features yet, but I am going to try and see
what
I can do. I'm still trying to learn it as quick as possible. If I see it
once
I usually I get it, but there is something I'm missing. I'll keep trying.
Thanks

"Nathan Sokalski" wrote:
Have you ever used the database features of ASP.NET before (ADO.NET and
the
System.Data namespace)? If you have, then you basically just need to do
that
same type of thing in the Click event of your send button. If you want
the
info sent as an email, take a look at the System.Net and System.Net.Mail
namespace. Some of the classes you are likely to use are MailAddress,
SmtpClient, and MailMessage. I'm sure there are many basic examples out
there, so look for one of the examples (videos may help sometimes, but
seeing a complete code example is sometimes better, since that's what you
want to learn how to do) and see if that helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:27**********************************@microsof t.com...
I designed a "contact_us" page in visual web developer 2005 express
along
with EW2 after viewing tutorials on asp.net's help page. Features work
like
they should, but I cannot figure out how to send contact info to email
or
data base when the "send" button is pressed. I've watched the tutorials
over
& over again. I just can't get it.
Link: http://www.syfloristonline.zipa.com/contact_us.aspx.
Need help


Nov 5 '08 #5

P: n/a
To connect to a database, do something like the following:

Include the following in your Web.config:

<configuration>
<appSettings>
<add key="connectionstring" value="YOUR CONNECTION STRING"/>
</appSettings>
</configuration>

Use something similar to the following to submit to the database:

Dim myconnection As New
System.Data.OleDb.OleDbConnection(System.Configura tion.ConfigurationManager.AppSettings("connections tring"))
Dim cmdsubmit As New OleDbCommand("YOUR SQL STATEMENT", myconnection)
myconnection.Open()
cmdsubmit.ExecuteNonQuery()
myconnection.Close()
To send an email:

Include the following in your Web.config:

<configuration>
<appSettings>
<add key="smtpserver" value="YOUR SMTP SERVER"/'For example,
"smtp.yourdomain.com"
</appSettings>
</configuration>

Dim toaddress As New MailAddress("nj********@hotmail.com", "Nathan
Sokalski")
Dim fromaddress As New MailAddress("nj********@hotmail.com", "Nathan
Sokalski")
Dim commentsender As New
SmtpClient(System.Configuration.ConfigurationManag er.AppSettings("smtpserver"))
commentsender.Credentials = New NetworkCredential("", "") 'This line may or
may not be necessary, ask your Webhost or network administrator
Dim commentmsg As New MailMessage(fromaddress, toaddress)
commentmsg.IsBodyHtml = False
commentMsg.Subject = "YOUR EMAIL SUBJECT"
commentMsg.Body = "YOUR MESSAGE BODY"
commentsender.Send(commentMsg)
If either of these do not work, look at the error messages to help determine
the reason. The reason (if there is one) is most likely due to server
configuration. If you have problems, post your code and the error, we may be
able to help you more with that info. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:E1**********************************@microsof t.com...
>I am lost. I cannot find info on what to do next on my web page. I have the
form completed on the contact us page, but have no idea how to connect to
the
database or send the form to an email. I feel stupid. Can it be this hard?

"Nathan Sokalski" wrote:
>I felt the same way when I first started learning .NET (They didn't teach
us
much in the one course I took). But a book that I bought, which probably
tought me more than any other individual resource, is:

ASP.NET 2.0 Unleashed by Stephen Walther
http://www.informit.com/store/produc...sbn=0672328232

There are versions of the book for the other versions of ASP.NET as well,
but one of the most wonderful things about the author is that the book is
example-oriented with complete examples. The author completely explains
every example, and the code comes on a CD in both VB.NET and C#. I think
the
example-oriented style will help you a lot, it definitely helped me.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:88**********************************@microso ft.com...
I've never used the database features yet, but I am going to try and
see
what
I can do. I'm still trying to learn it as quick as possible. If I see
it
once
I usually I get it, but there is something I'm missing. I'll keep
trying.
Thanks

"Nathan Sokalski" wrote:

Have you ever used the database features of ASP.NET before (ADO.NET
and
the
System.Data namespace)? If you have, then you basically just need to
do
that
same type of thing in the Click event of your send button. If you want
the
info sent as an email, take a look at the System.Net and
System.Net.Mail
namespace. Some of the classes you are likely to use are MailAddress,
SmtpClient, and MailMessage. I'm sure there are many basic examples
out
there, so look for one of the examples (videos may help sometimes, but
seeing a complete code example is sometimes better, since that's what
you
want to learn how to do) and see if that helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:27**********************************@microso ft.com...
I designed a "contact_us" page in visual web developer 2005 express
along
with EW2 after viewing tutorials on asp.net's help page. Features
work
like
they should, but I cannot figure out how to send contact info to
email
or
data base when the "send" button is pressed. I've watched the
tutorials
over
& over again. I just can't get it.
Link: http://www.syfloristonline.zipa.com/contact_us.aspx.
Need help



Nov 5 '08 #6

P: n/a
I have no idea where to add this code in the web config. Here is what I have
so far.

<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings>
<add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\syours.mdf;Integrated
Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.

Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="true" strict="false" explicit="true"/>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
The <authenticationsection enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms" />
<!--
The <customErrorssection enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly"
defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>

"Nathan Sokalski" wrote:
To connect to a database, do something like the following:

Include the following in your Web.config:

<configuration>
<appSettings>
<add key="connectionstring" value="YOUR CONNECTION STRING"/>
</appSettings>
</configuration>

Use something similar to the following to submit to the database:

Dim myconnection As New
System.Data.OleDb.OleDbConnection(System.Configura tion.ConfigurationManager.AppSettings("connections tring"))
Dim cmdsubmit As New OleDbCommand("YOUR SQL STATEMENT", myconnection)
myconnection.Open()
cmdsubmit.ExecuteNonQuery()
myconnection.Close()
To send an email:

Include the following in your Web.config:

<configuration>
<appSettings>
<add key="smtpserver" value="YOUR SMTP SERVER"/'For example,
"smtp.yourdomain.com"
</appSettings>
</configuration>

Dim toaddress As New MailAddress("nj********@hotmail.com", "Nathan
Sokalski")
Dim fromaddress As New MailAddress("nj********@hotmail.com", "Nathan
Sokalski")
Dim commentsender As New
SmtpClient(System.Configuration.ConfigurationManag er.AppSettings("smtpserver"))
commentsender.Credentials = New NetworkCredential("", "") 'This line may or
may not be necessary, ask your Webhost or network administrator
Dim commentmsg As New MailMessage(fromaddress, toaddress)
commentmsg.IsBodyHtml = False
commentMsg.Subject = "YOUR EMAIL SUBJECT"
commentMsg.Body = "YOUR MESSAGE BODY"
commentsender.Send(commentMsg)
If either of these do not work, look at the error messages to help determine
the reason. The reason (if there is one) is most likely due to server
configuration. If you have problems, post your code and the error, we may be
able to help you more with that info. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:E1**********************************@microsof t.com...
I am lost. I cannot find info on what to do next on my web page. I have the
form completed on the contact us page, but have no idea how to connect to
the
database or send the form to an email. I feel stupid. Can it be this hard?

"Nathan Sokalski" wrote:
I felt the same way when I first started learning .NET (They didn't teach
us
much in the one course I took). But a book that I bought, which probably
tought me more than any other individual resource, is:

ASP.NET 2.0 Unleashed by Stephen Walther
http://www.informit.com/store/produc...sbn=0672328232

There are versions of the book for the other versions of ASP.NET as well,
but one of the most wonderful things about the author is that the book is
example-oriented with complete examples. The author completely explains
every example, and the code comes on a CD in both VB.NET and C#. I think
the
example-oriented style will help you a lot, it definitely helped me.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:88**********************************@microsof t.com...
I've never used the database features yet, but I am going to try and
see
what
I can do. I'm still trying to learn it as quick as possible. If I see
it
once
I usually I get it, but there is something I'm missing. I'll keep
trying.
Thanks

"Nathan Sokalski" wrote:

Have you ever used the database features of ASP.NET before (ADO.NET
and
the
System.Data namespace)? If you have, then you basically just need to
do
that
same type of thing in the Click event of your send button. If you want
the
info sent as an email, take a look at the System.Net and
System.Net.Mail
namespace. Some of the classes you are likely to use are MailAddress,
SmtpClient, and MailMessage. I'm sure there are many basic examples
out
there, so look for one of the examples (videos may help sometimes, but
seeing a complete code example is sometimes better, since that's what
you
want to learn how to do) and see if that helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:27**********************************@microsof t.com...
I designed a "contact_us" page in visual web developer 2005 express
along
with EW2 after viewing tutorials on asp.net's help page. Features
work
like
they should, but I cannot figure out how to send contact info to
email
or
data base when the "send" button is pressed. I've watched the
tutorials
over
& over again. I just can't get it.
Link: http://www.syfloristonline.zipa.com/contact_us.aspx.
Need help



Nov 5 '08 #7

P: n/a
Change <appSettings/to the following:

<appSettings>
<add key="connectionstring" value="YOUR CONNECTION STRING"/>
</appSettings>

If you prefer to use the <connectionStringselement for your
connectionstrings, it looks like you already know how to do that (just make
sure you correctly modify the code I gave you if you do that). You need to
remember that in XML (which is actually what a *.config file is) <tagname/>
is equivelant to <tagname></tagname>.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:86**********************************@microsof t.com...
>I have no idea where to add this code in the web config. Here is what I
have
so far.

<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings>
<add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\syours.mdf;Integrated
Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.

Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="true" strict="false" explicit="true"/>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
The <authenticationsection enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms" />
<!--
The <customErrorssection enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly"
defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>

"Nathan Sokalski" wrote:
>To connect to a database, do something like the following:

Include the following in your Web.config:

<configuration>
<appSettings>
<add key="connectionstring" value="YOUR CONNECTION STRING"/>
</appSettings>
</configuration>

Use something similar to the following to submit to the database:

Dim myconnection As New
System.Data.OleDb.OleDbConnection(System.Configur ation.ConfigurationManager.AppSettings("connection string"))
Dim cmdsubmit As New OleDbCommand("YOUR SQL STATEMENT", myconnection)
myconnection.Open()
cmdsubmit.ExecuteNonQuery()
myconnection.Close()
To send an email:

Include the following in your Web.config:

<configuration>
<appSettings>
<add key="smtpserver" value="YOUR SMTP SERVER"/'For example,
"smtp.yourdomain.com"
</appSettings>
</configuration>

Dim toaddress As New MailAddress("nj********@hotmail.com", "Nathan
Sokalski")
Dim fromaddress As New MailAddress("nj********@hotmail.com", "Nathan
Sokalski")
Dim commentsender As New
SmtpClient(System.Configuration.ConfigurationMana ger.AppSettings("smtpserver"))
commentsender.Credentials = New NetworkCredential("", "") 'This line may
or
may not be necessary, ask your Webhost or network administrator
Dim commentmsg As New MailMessage(fromaddress, toaddress)
commentmsg.IsBodyHtml = False
commentMsg.Subject = "YOUR EMAIL SUBJECT"
commentMsg.Body = "YOUR MESSAGE BODY"
commentsender.Send(commentMsg)
If either of these do not work, look at the error messages to help
determine
the reason. The reason (if there is one) is most likely due to server
configuration. If you have problems, post your code and the error, we may
be
able to help you more with that info. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:E1**********************************@microso ft.com...
>I am lost. I cannot find info on what to do next on my web page. I have
the
form completed on the contact us page, but have no idea how to connect
to
the
database or send the form to an email. I feel stupid. Can it be this
hard?

"Nathan Sokalski" wrote:

I felt the same way when I first started learning .NET (They didn't
teach
us
much in the one course I took). But a book that I bought, which
probably
tought me more than any other individual resource, is:

ASP.NET 2.0 Unleashed by Stephen Walther
http://www.informit.com/store/produc...sbn=0672328232

There are versions of the book for the other versions of ASP.NET as
well,
but one of the most wonderful things about the author is that the book
is
example-oriented with complete examples. The author completely
explains
every example, and the code comes on a CD in both VB.NET and C#. I
think
the
example-oriented style will help you a lot, it definitely helped me.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:88**********************************@microso ft.com...
I've never used the database features yet, but I am going to try and
see
what
I can do. I'm still trying to learn it as quick as possible. If I
see
it
once
I usually I get it, but there is something I'm missing. I'll keep
trying.
Thanks

"Nathan Sokalski" wrote:

Have you ever used the database features of ASP.NET before (ADO.NET
and
the
System.Data namespace)? If you have, then you basically just need
to
do
that
same type of thing in the Click event of your send button. If you
want
the
info sent as an email, take a look at the System.Net and
System.Net.Mail
namespace. Some of the classes you are likely to use are
MailAddress,
SmtpClient, and MailMessage. I'm sure there are many basic examples
out
there, so look for one of the examples (videos may help sometimes,
but
seeing a complete code example is sometimes better, since that's
what
you
want to learn how to do) and see if that helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:27**********************************@microso ft.com...
I designed a "contact_us" page in visual web developer 2005
express
along
with EW2 after viewing tutorials on asp.net's help page. Features
work
like
they should, but I cannot figure out how to send contact info to
email
or
data base when the "send" button is pressed. I've watched the
tutorials
over
& over again. I just can't get it.
Link: http://www.syfloristonline.zipa.com/contact_us.aspx.
Need help




Nov 6 '08 #8

P: n/a
Still VERY VERY lost. I didn't add "connectionstring" It was just there. I
have no idea how the web config did any of that. All I want to do is send
info from a form to an email. Why is this so hard to figure out? Am I that
stupid?

"Nathan Sokalski" wrote:
Change <appSettings/to the following:

<appSettings>
<add key="connectionstring" value="YOUR CONNECTION STRING"/>
</appSettings>

If you prefer to use the <connectionStringselement for your
connectionstrings, it looks like you already know how to do that (just make
sure you correctly modify the code I gave you if you do that). You need to
remember that in XML (which is actually what a *.config file is) <tagname/>
is equivelant to <tagname></tagname>.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:86**********************************@microsof t.com...
I have no idea where to add this code in the web config. Here is what I
have
so far.

<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings>
<add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\syours.mdf;Integrated
Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.

Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="true" strict="false" explicit="true"/>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
The <authenticationsection enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms" />
<!--
The <customErrorssection enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly"
defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>

"Nathan Sokalski" wrote:
To connect to a database, do something like the following:

Include the following in your Web.config:

<configuration>
<appSettings>
<add key="connectionstring" value="YOUR CONNECTION STRING"/>
</appSettings>
</configuration>

Use something similar to the following to submit to the database:

Dim myconnection As New
System.Data.OleDb.OleDbConnection(System.Configura tion.ConfigurationManager.AppSettings("connections tring"))
Dim cmdsubmit As New OleDbCommand("YOUR SQL STATEMENT", myconnection)
myconnection.Open()
cmdsubmit.ExecuteNonQuery()
myconnection.Close()
To send an email:

Include the following in your Web.config:

<configuration>
<appSettings>
<add key="smtpserver" value="YOUR SMTP SERVER"/'For example,
"smtp.yourdomain.com"
</appSettings>
</configuration>

Dim toaddress As New MailAddress("nj********@hotmail.com", "Nathan
Sokalski")
Dim fromaddress As New MailAddress("nj********@hotmail.com", "Nathan
Sokalski")
Dim commentsender As New
SmtpClient(System.Configuration.ConfigurationManag er.AppSettings("smtpserver"))
commentsender.Credentials = New NetworkCredential("", "") 'This line may
or
may not be necessary, ask your Webhost or network administrator
Dim commentmsg As New MailMessage(fromaddress, toaddress)
commentmsg.IsBodyHtml = False
commentMsg.Subject = "YOUR EMAIL SUBJECT"
commentMsg.Body = "YOUR MESSAGE BODY"
commentsender.Send(commentMsg)
If either of these do not work, look at the error messages to help
determine
the reason. The reason (if there is one) is most likely due to server
configuration. If you have problems, post your code and the error, we may
be
able to help you more with that info. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:E1**********************************@microsof t.com...
I am lost. I cannot find info on what to do next on my web page. I have
the
form completed on the contact us page, but have no idea how to connect
to
the
database or send the form to an email. I feel stupid. Can it be this
hard?

"Nathan Sokalski" wrote:

I felt the same way when I first started learning .NET (They didn't
teach
us
much in the one course I took). But a book that I bought, which
probably
tought me more than any other individual resource, is:

ASP.NET 2.0 Unleashed by Stephen Walther
http://www.informit.com/store/produc...sbn=0672328232

There are versions of the book for the other versions of ASP.NET as
well,
but one of the most wonderful things about the author is that the book
is
example-oriented with complete examples. The author completely
explains
every example, and the code comes on a CD in both VB.NET and C#. I
think
the
example-oriented style will help you a lot, it definitely helped me.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:88**********************************@microsof t.com...
I've never used the database features yet, but I am going to try and
see
what
I can do. I'm still trying to learn it as quick as possible. If I
see
it
once
I usually I get it, but there is something I'm missing. I'll keep
trying.
Thanks

"Nathan Sokalski" wrote:

Have you ever used the database features of ASP.NET before (ADO.NET
and
the
System.Data namespace)? If you have, then you basically just need
to
do
that
same type of thing in the Click event of your send button. If you
want
the
info sent as an email, take a look at the System.Net and
System.Net.Mail
namespace. Some of the classes you are likely to use are
MailAddress,
SmtpClient, and MailMessage. I'm sure there are many basic examples
out
there, so look for one of the examples (videos may help sometimes,
but
seeing a complete code example is sometimes better, since that's
what
you
want to learn how to do) and see if that helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:27**********************************@microsof t.com...
I designed a "contact_us" page in visual web developer 2005
express
along
with EW2 after viewing tutorials on asp.net's help page. Features
work
like
they should, but I cannot figure out how to send contact info to
email
or
data base when the "send" button is pressed. I've watched the
tutorials
over
& over again. I just can't get it.
Link: http://www.syfloristonline.zipa.com/contact_us.aspx.
Need help




Nov 6 '08 #9

P: n/a
What do you have in your Web.config in the <appSettings></appSettings>
element? You should have an <add/element that specifies your SMTP server.
Why don't you post exactly what you have in this part of your Web.config, as
well as the code you currently have that you are trying to use to send the
email. If you are recieving an error (any error at all) when running this
code, let me know that as well. This will help me narrow down the problem.
Also, make sure you have the necessary permissions to send an email from the
specified SMTP server and check with the administrator of the SMTP server as
to what you may need for the Credentials property.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:07**********************************@microsof t.com...
Still VERY VERY lost. I didn't add "connectionstring" It was just there. I
have no idea how the web config did any of that. All I want to do is send
info from a form to an email. Why is this so hard to figure out? Am I that
stupid?

"Nathan Sokalski" wrote:
>Change <appSettings/to the following:

<appSettings>
<add key="connectionstring" value="YOUR CONNECTION STRING"/>
</appSettings>

If you prefer to use the <connectionStringselement for your
connectionstrings, it looks like you already know how to do that (just
make
sure you correctly modify the code I gave you if you do that). You need
to
remember that in XML (which is actually what a *.config file is)
<tagname/>
is equivelant to <tagname></tagname>.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:86**********************************@microso ft.com...
>I have no idea where to add this code in the web config. Here is what I
have
so far.

<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings>
<add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\syours.mdf;Integrated
Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.

Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="true" strict="false" explicit="true"/>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
The <authenticationsection enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms" />
<!--
The <customErrorssection enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly"
defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>

"Nathan Sokalski" wrote:

To connect to a database, do something like the following:

Include the following in your Web.config:

<configuration>
<appSettings>
<add key="connectionstring" value="YOUR CONNECTION STRING"/>
</appSettings>
</configuration>

Use something similar to the following to submit to the database:

Dim myconnection As New
System.Data.OleDb.OleDbConnection(System.Configur ation.ConfigurationManager.AppSettings("connection string"))
Dim cmdsubmit As New OleDbCommand("YOUR SQL STATEMENT", myconnection)
myconnection.Open()
cmdsubmit.ExecuteNonQuery()
myconnection.Close()
To send an email:

Include the following in your Web.config:

<configuration>
<appSettings>
<add key="smtpserver" value="YOUR SMTP SERVER"/'For example,
"smtp.yourdomain.com"
</appSettings>
</configuration>

Dim toaddress As New MailAddress("nj********@hotmail.com", "Nathan
Sokalski")
Dim fromaddress As New MailAddress("nj********@hotmail.com", "Nathan
Sokalski")
Dim commentsender As New
SmtpClient(System.Configuration.ConfigurationMana ger.AppSettings("smtpserver"))
commentsender.Credentials = New NetworkCredential("", "") 'This line
may
or
may not be necessary, ask your Webhost or network administrator
Dim commentmsg As New MailMessage(fromaddress, toaddress)
commentmsg.IsBodyHtml = False
commentMsg.Subject = "YOUR EMAIL SUBJECT"
commentMsg.Body = "YOUR MESSAGE BODY"
commentsender.Send(commentMsg)
If either of these do not work, look at the error messages to help
determine
the reason. The reason (if there is one) is most likely due to server
configuration. If you have problems, post your code and the error, we
may
be
able to help you more with that info. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:E1**********************************@microso ft.com...
I am lost. I cannot find info on what to do next on my web page. I
have
the
form completed on the contact us page, but have no idea how to
connect
to
the
database or send the form to an email. I feel stupid. Can it be this
hard?

"Nathan Sokalski" wrote:

I felt the same way when I first started learning .NET (They didn't
teach
us
much in the one course I took). But a book that I bought, which
probably
tought me more than any other individual resource, is:

ASP.NET 2.0 Unleashed by Stephen Walther
http://www.informit.com/store/produc...sbn=0672328232

There are versions of the book for the other versions of ASP.NET as
well,
but one of the most wonderful things about the author is that the
book
is
example-oriented with complete examples. The author completely
explains
every example, and the code comes on a CD in both VB.NET and C#. I
think
the
example-oriented style will help you a lot, it definitely helped
me.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:88**********************************@microso ft.com...
I've never used the database features yet, but I am going to try
and
see
what
I can do. I'm still trying to learn it as quick as possible. If I
see
it
once
I usually I get it, but there is something I'm missing. I'll keep
trying.
Thanks

"Nathan Sokalski" wrote:

Have you ever used the database features of ASP.NET before
(ADO.NET
and
the
System.Data namespace)? If you have, then you basically just
need
to
do
that
same type of thing in the Click event of your send button. If
you
want
the
info sent as an email, take a look at the System.Net and
System.Net.Mail
namespace. Some of the classes you are likely to use are
MailAddress,
SmtpClient, and MailMessage. I'm sure there are many basic
examples
out
there, so look for one of the examples (videos may help
sometimes,
but
seeing a complete code example is sometimes better, since that's
what
you
want to learn how to do) and see if that helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:27**********************************@microso ft.com...
I designed a "contact_us" page in visual web developer 2005
express
along
with EW2 after viewing tutorials on asp.net's help page.
Features
work
like
they should, but I cannot figure out how to send contact info
to
email
or
data base when the "send" button is pressed. I've watched the
tutorials
over
& over again. I just can't get it.
Link: http://www.syfloristonline.zipa.com/contact_us.aspx.
Need help





Nov 7 '08 #10

P: n/a
Thats strange, I can send mail through smtp just fine but my email settings
are in <System.Net.Mailsection in web.config.
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:OI****************@TK2MSFTNGP06.phx.gbl...
What do you have in your Web.config in the <appSettings></appSettings>
element? You should have an <add/element that specifies your SMTP
server. Why don't you post exactly what you have in this part of your
Web.config, as well as the code you currently have that you are trying to
use to send the email. If you are recieving an error (any error at all)
when running this code, let me know that as well. This will help me narrow
down the problem. Also, make sure you have the necessary permissions to
send an email from the specified SMTP server and check with the
administrator of the SMTP server as to what you may need for the
Credentials property.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:07**********************************@microsof t.com...
>Still VERY VERY lost. I didn't add "connectionstring" It was just there.
I
have no idea how the web config did any of that. All I want to do is send
info from a form to an email. Why is this so hard to figure out? Am I
that
stupid?

"Nathan Sokalski" wrote:
>>Change <appSettings/to the following:

<appSettings>
<add key="connectionstring" value="YOUR CONNECTION STRING"/>
</appSettings>

If you prefer to use the <connectionStringselement for your
connectionstrings, it looks like you already know how to do that (just
make
sure you correctly modify the code I gave you if you do that). You need
to
remember that in XML (which is actually what a *.config file is)
<tagname/>
is equivelant to <tagname></tagname>.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:86**********************************@micros oft.com...
I have no idea where to add this code in the web config. Here is what I
have
so far.

<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings>
<add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirecto ry|\syours.mdf;Integrated
Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.

Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="true" strict="false" explicit="true"/>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
The <authenticationsection enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms" />
<!--
The <customErrorssection enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly"
defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>

"Nathan Sokalski" wrote:

To connect to a database, do something like the following:

Include the following in your Web.config:

<configuration>
<appSettings>
<add key="connectionstring" value="YOUR CONNECTION STRING"/>
</appSettings>
</configuration>

Use something similar to the following to submit to the database:

Dim myconnection As New
System.Data.OleDb.OleDbConnection(System.Configu ration.ConfigurationManager.AppSettings("connectio nstring"))
Dim cmdsubmit As New OleDbCommand("YOUR SQL STATEMENT", myconnection)
myconnection.Open()
cmdsubmit.ExecuteNonQuery()
myconnection.Close()
To send an email:

Include the following in your Web.config:

<configuration>
<appSettings>
<add key="smtpserver" value="YOUR SMTP SERVER"/'For
example,
"smtp.yourdomain.com"
</appSettings>
</configuration>

Dim toaddress As New MailAddress("nj********@hotmail.com", "Nathan
Sokalski")
Dim fromaddress As New MailAddress("nj********@hotmail.com", "Nathan
Sokalski")
Dim commentsender As New
SmtpClient(System.Configuration.ConfigurationMan ager.AppSettings("smtpserver"))
commentsender.Credentials = New NetworkCredential("", "") 'This line
may
or
may not be necessary, ask your Webhost or network administrator
Dim commentmsg As New MailMessage(fromaddress, toaddress)
commentmsg.IsBodyHtml = False
commentMsg.Subject = "YOUR EMAIL SUBJECT"
commentMsg.Body = "YOUR MESSAGE BODY"
commentsender.Send(commentMsg)
If either of these do not work, look at the error messages to help
determine
the reason. The reason (if there is one) is most likely due to server
configuration. If you have problems, post your code and the error, we
may
be
able to help you more with that info. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:E1**********************************@micros oft.com...
I am lost. I cannot find info on what to do next on my web page. I
have
the
form completed on the contact us page, but have no idea how to
connect
to
the
database or send the form to an email. I feel stupid. Can it be
this
hard?

"Nathan Sokalski" wrote:

I felt the same way when I first started learning .NET (They
didn't
teach
us
much in the one course I took). But a book that I bought, which
probably
tought me more than any other individual resource, is:

ASP.NET 2.0 Unleashed by Stephen Walther
http://www.informit.com/store/produc...sbn=0672328232

There are versions of the book for the other versions of ASP.NET
as
well,
but one of the most wonderful things about the author is that the
book
is
example-oriented with complete examples. The author completely
explains
every example, and the code comes on a CD in both VB.NET and C#. I
think
the
example-oriented style will help you a lot, it definitely helped
me.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:88**********************************@micros oft.com...
I've never used the database features yet, but I am going to try
and
see
what
I can do. I'm still trying to learn it as quick as possible. If
I
see
it
once
I usually I get it, but there is something I'm missing. I'll
keep
trying.
Thanks

"Nathan Sokalski" wrote:

Have you ever used the database features of ASP.NET before
(ADO.NET
and
the
System.Data namespace)? If you have, then you basically just
need
to
do
that
same type of thing in the Click event of your send button. If
you
want
the
info sent as an email, take a look at the System.Net and
System.Net.Mail
namespace. Some of the classes you are likely to use are
MailAddress,
SmtpClient, and MailMessage. I'm sure there are many basic
examples
out
there, so look for one of the examples (videos may help
sometimes,
but
seeing a complete code example is sometimes better, since
that's
what
you
want to learn how to do) and see if that helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:27**********************************@micros oft.com...
I designed a "contact_us" page in visual web developer 2005
express
along
with EW2 after viewing tutorials on asp.net's help page.
Features
work
like
they should, but I cannot figure out how to send contact info
to
email
or
data base when the "send" button is pressed. I've watched the
tutorials
over
& over again. I just can't get it.
Link: http://www.syfloristonline.zipa.com/contact_us.aspx.
Need help





Nov 7 '08 #11

P: n/a
The way I am doing it is not necessarily the only way, so there may be other
ways that involve placing more in the Web.config than I did. I simply use
the technique I do because it is simple, short, and allows me to send an
email with any format I can create the content for. But if an example or
instructions you find on another website use a different technique, don't be
extremely surprised, because there are very few things in .NET (or any
language/framework) that can only be done one way.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Andy B" <a_*****@sbcglobal.netwrote in message
news:OV**************@TK2MSFTNGP03.phx.gbl...
Thats strange, I can send mail through smtp just fine but my email
settings are in <System.Net.Mailsection in web.config.
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:OI****************@TK2MSFTNGP06.phx.gbl...
>What do you have in your Web.config in the <appSettings></appSettings>
element? You should have an <add/element that specifies your SMTP
server. Why don't you post exactly what you have in this part of your
Web.config, as well as the code you currently have that you are trying to
use to send the email. If you are recieving an error (any error at all)
when running this code, let me know that as well. This will help me
narrow down the problem. Also, make sure you have the necessary
permissions to send an email from the specified SMTP server and check
with the administrator of the SMTP server as to what you may need for the
Credentials property.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:07**********************************@microso ft.com...
>>Still VERY VERY lost. I didn't add "connectionstring" It was just there.
I
have no idea how the web config did any of that. All I want to do is
send
info from a form to an email. Why is this so hard to figure out? Am I
that
stupid?

"Nathan Sokalski" wrote:

Change <appSettings/to the following:

<appSettings>
<add key="connectionstring" value="YOUR CONNECTION STRING"/>
</appSettings>

If you prefer to use the <connectionStringselement for your
connectionstrings, it looks like you already know how to do that (just
make
sure you correctly modify the code I gave you if you do that). You need
to
remember that in XML (which is actually what a *.config file is)
<tagname/>
is equivelant to <tagname></tagname>.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:86**********************************@micro soft.com...
I have no idea where to add this code in the web config. Here is what
I
have
so far.

<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings>
<add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirect ory|\syours.mdf;Integrated
Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.

Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="true" strict="false" explicit="true"/>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
The <authenticationsection enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms" />
<!--
The <customErrorssection enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly"
defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>

"Nathan Sokalski" wrote:

To connect to a database, do something like the following:

Include the following in your Web.config:

<configuration>
<appSettings>
<add key="connectionstring" value="YOUR CONNECTION STRING"/>
</appSettings>
</configuration>

Use something similar to the following to submit to the database:

Dim myconnection As New
System.Data.OleDb.OleDbConnection(System.Config uration.ConfigurationManager.AppSettings("connecti onstring"))
Dim cmdsubmit As New OleDbCommand("YOUR SQL STATEMENT",
myconnection)
myconnection.Open()
cmdsubmit.ExecuteNonQuery()
myconnection.Close()
To send an email:

Include the following in your Web.config:

<configuration>
<appSettings>
<add key="smtpserver" value="YOUR SMTP SERVER"/'For
example,
"smtp.yourdomain.com"
</appSettings>
</configuration>

Dim toaddress As New MailAddress("nj********@hotmail.com", "Nathan
Sokalski")
Dim fromaddress As New MailAddress("nj********@hotmail.com", "Nathan
Sokalski")
Dim commentsender As New
SmtpClient(System.Configuration.ConfigurationMa nager.AppSettings("smtpserver"))
commentsender.Credentials = New NetworkCredential("", "") 'This line
may
or
may not be necessary, ask your Webhost or network administrator
Dim commentmsg As New MailMessage(fromaddress, toaddress)
commentmsg.IsBodyHtml = False
commentMsg.Subject = "YOUR EMAIL SUBJECT"
commentMsg.Body = "YOUR MESSAGE BODY"
commentsender.Send(commentMsg)
If either of these do not work, look at the error messages to help
determine
the reason. The reason (if there is one) is most likely due to
server
configuration. If you have problems, post your code and the error,
we may
be
able to help you more with that info. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:E1**********************************@micro soft.com...
I am lost. I cannot find info on what to do next on my web page. I
have
the
form completed on the contact us page, but have no idea how to
connect
to
the
database or send the form to an email. I feel stupid. Can it be
this
hard?

"Nathan Sokalski" wrote:

I felt the same way when I first started learning .NET (They
didn't
teach
us
much in the one course I took). But a book that I bought, which
probably
tought me more than any other individual resource, is:

ASP.NET 2.0 Unleashed by Stephen Walther
http://www.informit.com/store/produc...sbn=0672328232

There are versions of the book for the other versions of ASP.NET
as
well,
but one of the most wonderful things about the author is that the
book
is
example-oriented with complete examples. The author completely
explains
every example, and the code comes on a CD in both VB.NET and C#.
I
think
the
example-oriented style will help you a lot, it definitely helped
me.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:88**********************************@micro soft.com...
I've never used the database features yet, but I am going to
try and
see
what
I can do. I'm still trying to learn it as quick as possible. If
I
see
it
once
I usually I get it, but there is something I'm missing. I'll
keep
trying.
Thanks

"Nathan Sokalski" wrote:

Have you ever used the database features of ASP.NET before
(ADO.NET
and
the
System.Data namespace)? If you have, then you basically just
need
to
do
that
same type of thing in the Click event of your send button. If
you
want
the
info sent as an email, take a look at the System.Net and
System.Net.Mail
namespace. Some of the classes you are likely to use are
MailAddress,
SmtpClient, and MailMessage. I'm sure there are many basic
examples
out
there, so look for one of the examples (videos may help
sometimes,
but
seeing a complete code example is sometimes better, since
that's
what
you
want to learn how to do) and see if that helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:27**********************************@micro soft.com...
I designed a "contact_us" page in visual web developer 2005
express
along
with EW2 after viewing tutorials on asp.net's help page.
Features
work
like
they should, but I cannot figure out how to send contact
info to
email
or
data base when the "send" button is pressed. I've watched
the
tutorials
over
& over again. I just can't get it.
Link: http://www.syfloristonline.zipa.com/contact_us.aspx.
Need help






Nov 7 '08 #12

P: n/a
Right. I wasn't really saying that I was surprised that it was done that
way. I was just saying that I have never seen it like that and all the
Microsoft help says to do is put that stuff in System.Net.Mail and off you
go.
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:uv*************@TK2MSFTNGP05.phx.gbl...
The way I am doing it is not necessarily the only way, so there may be
other ways that involve placing more in the Web.config than I did. I
simply use the technique I do because it is simple, short, and allows me
to send an email with any format I can create the content for. But if an
example or instructions you find on another website use a different
technique, don't be extremely surprised, because there are very few things
in .NET (or any language/framework) that can only be done one way.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Andy B" <a_*****@sbcglobal.netwrote in message
news:OV**************@TK2MSFTNGP03.phx.gbl...
>Thats strange, I can send mail through smtp just fine but my email
settings are in <System.Net.Mailsection in web.config.
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:OI****************@TK2MSFTNGP06.phx.gbl...
>>What do you have in your Web.config in the <appSettings></appSettings>
element? You should have an <add/element that specifies your SMTP
server. Why don't you post exactly what you have in this part of your
Web.config, as well as the code you currently have that you are trying
to use to send the email. If you are recieving an error (any error at
all) when running this code, let me know that as well. This will help me
narrow down the problem. Also, make sure you have the necessary
permissions to send an email from the specified SMTP server and check
with the administrator of the SMTP server as to what you may need for
the Credentials property.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"dgow" <dg**@discussions.microsoft.comwrote in message
news:07**********************************@micros oft.com...
Still VERY VERY lost. I didn't add "connectionstring" It was just
there. I
have no idea how the web config did any of that. All I want to do is
send
info from a form to an email. Why is this so hard to figure out? Am I
that
stupid?

"Nathan Sokalski" wrote:

Change <appSettings/to the following:
>
<appSettings>
<add key="connectionstring" value="YOUR CONNECTION STRING"/>
</appSettings>
>
If you prefer to use the <connectionStringselement for your
connectionstrings, it looks like you already know how to do that (just
make
sure you correctly modify the code I gave you if you do that). You
need to
remember that in XML (which is actually what a *.config file is)
<tagname/>
is equivelant to <tagname></tagname>.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
>
"dgow" <dg**@discussions.microsoft.comwrote in message
news:86**********************************@micr osoft.com...
I have no idea where to add this code in the web config. Here is what
I
have
so far.

<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings>
<add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirec tory|\syours.mdf;Integrated
Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.

Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all
variables.
-->
<compilation debug="true" strict="false" explicit="true"/>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
The <authenticationsection enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms" />
<!--
The <customErrorssection enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly"
defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>

"Nathan Sokalski" wrote:

To connect to a database, do something like the following:
>
Include the following in your Web.config:
>
<configuration>
<appSettings>
<add key="connectionstring" value="YOUR CONNECTION
STRING"/>
</appSettings>
</configuration>
>
Use something similar to the following to submit to the database:
>
Dim myconnection As New
System.Data.OleDb.OleDbConnection(System.Confi guration.ConfigurationManager.AppSettings("connect ionstring"))
Dim cmdsubmit As New OleDbCommand("YOUR SQL STATEMENT",
myconnection)
myconnection.Open()
cmdsubmit.ExecuteNonQuery()
myconnection.Close()
>
>
To send an email:
>
Include the following in your Web.config:
>
<configuration>
<appSettings>
<add key="smtpserver" value="YOUR SMTP SERVER"/'For
example,
"smtp.yourdomain.com"
</appSettings>
</configuration>
>
Dim toaddress As New MailAddress("nj********@hotmail.com", "Nathan
Sokalski")
Dim fromaddress As New MailAddress("nj********@hotmail.com",
"Nathan
Sokalski")
Dim commentsender As New
SmtpClient(System.Configuration.ConfigurationM anager.AppSettings("smtpserver"))
commentsender.Credentials = New NetworkCredential("", "") 'This
line may
or
may not be necessary, ask your Webhost or network administrator
Dim commentmsg As New MailMessage(fromaddress, toaddress)
commentmsg.IsBodyHtml = False
commentMsg.Subject = "YOUR EMAIL SUBJECT"
commentMsg.Body = "YOUR MESSAGE BODY"
commentsender.Send(commentMsg)
>
>
If either of these do not work, look at the error messages to help
determine
the reason. The reason (if there is one) is most likely due to
server
configuration. If you have problems, post your code and the error,
we may
be
able to help you more with that info. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
>
"dgow" <dg**@discussions.microsoft.comwrote in message
news:E1**********************************@micr osoft.com...
I am lost. I cannot find info on what to do next on my web page. I
have
the
form completed on the contact us page, but have no idea how to
connect
to
the
database or send the form to an email. I feel stupid. Can it be
this
hard?

"Nathan Sokalski" wrote:

I felt the same way when I first started learning .NET (They
didn't
teach
us
much in the one course I took). But a book that I bought, which
probably
tought me more than any other individual resource, is:
>
ASP.NET 2.0 Unleashed by Stephen Walther
http://www.informit.com/store/produc...sbn=0672328232
>
There are versions of the book for the other versions of ASP.NET
as
well,
but one of the most wonderful things about the author is that
the book
is
example-oriented with complete examples. The author completely
explains
every example, and the code comes on a CD in both VB.NET and C#.
I
think
the
example-oriented style will help you a lot, it definitely helped
me.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
>
"dgow" <dg**@discussions.microsoft.comwrote in message
news:88**********************************@micr osoft.com...
I've never used the database features yet, but I am going to
try and
see
what
I can do. I'm still trying to learn it as quick as possible.
If I
see
it
once
I usually I get it, but there is something I'm missing. I'll
keep
trying.
Thanks

"Nathan Sokalski" wrote:

Have you ever used the database features of ASP.NET before
(ADO.NET
and
the
System.Data namespace)? If you have, then you basically just
need
to
do
that
same type of thing in the Click event of your send button. If
you
want
the
info sent as an email, take a look at the System.Net and
System.Net.Mail
namespace. Some of the classes you are likely to use are
MailAddress,
SmtpClient, and MailMessage. I'm sure there are many basic
examples
out
there, so look for one of the examples (videos may help
sometimes,
but
seeing a complete code example is sometimes better, since
that's
what
you
want to learn how to do) and see if that helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
>
"dgow" <dg**@discussions.microsoft.comwrote in message
news:27**********************************@micr osoft.com...
I designed a "contact_us" page in visual web developer 2005
express
along
with EW2 after viewing tutorials on asp.net's help page.
Features
work
like
they should, but I cannot figure out how to send contact
info to
email
or
data base when the "send" button is pressed. I've watched
the
tutorials
over
& over again. I just can't get it.
Link: http://www.syfloristonline.zipa.com/contact_us.aspx.
Need help
>
>
>
>
>
>
>
>
>
>
>
>




Nov 7 '08 #13

This discussion thread is closed

Replies have been disabled for this discussion.