Using VisualStudio 2005, asp.net 2.0:
What do I put in my Web.Config to avoid hard coding the: myserveraddress.com?
The following shows how I have hard coded it without having the value in the
we.config, and it works. However, I would like to place it in my web.config
file, and then just get the value from the web.config?
Can someone tell me what I need to add to the web.config
//send the message
System.Net.Mail.SmtpClient smtp = new
System.Net.Mail.SmtpClient("smtp.myserveraddress.c om");
smtp.Send(mail); 6 10470
check my blog: http://spaces.msn.com/sholliday/ 2/8/2006 entry
I wrote a very nice (if I do say so my self) for having lots of flexibility
with smtp server settings.
There is a 2.0 and 1.1 example.
"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com... Using VisualStudio 2005, asp.net 2.0:
What do I put in my Web.Config to avoid hard coding the:
myserveraddress.com? The following shows how I have hard coded it without having the value in
the we.config, and it works. However, I would like to place it in my
web.config file, and then just get the value from the web.config?
Can someone tell me what I need to add to the web.config
//send the message System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.myserveraddress.c om"); smtp.Send(mail);
The solution offered is more than I need.
Can someone simply provide a sample of the lines that I need to add to the
web.config for asp.net 2.0.
"sloan" wrote: check my blog: http://spaces.msn.com/sholliday/ 2/8/2006 entry
I wrote a very nice (if I do say so my self) for having lots of flexibility with smtp server settings.
There is a 2.0 and 1.1 example.
"theWizard1" <th********@discussions.microsoft.com> wrote in message news:64**********************************@microsof t.com... Using VisualStudio 2005, asp.net 2.0:
What do I put in my Web.Config to avoid hard coding the: myserveraddress.com? The following shows how I have hard coded it without having the value in
the we.config, and it works. However, I would like to place it in my web.config file, and then just get the value from the web.config?
Can someone tell me what I need to add to the web.config
//send the message System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.myserveraddress.c om"); smtp.Send(mail);
Add the <mailSettings> block in <system.net> block in the web.config file.
for e.g.
<system.net>
<mailSettings>
<smtp from="fr**@test.com">
<network host="127.0.0.1"
password="" userName="" />
</smtp>
</mailSettings>
</system.net>
--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET) http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ... http://www.swanandmokashi.com/ http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:FD**********************************@microsof t.com... The solution offered is more than I need.
Can someone simply provide a sample of the lines that I need to add to the web.config for asp.net 2.0.
"sloan" wrote:
check my blog: http://spaces.msn.com/sholliday/ 2/8/2006 entry
I wrote a very nice (if I do say so my self) for having lots of flexibility with smtp server settings.
There is a 2.0 and 1.1 example.
"theWizard1" <th********@discussions.microsoft.com> wrote in message news:64**********************************@microsof t.com... > Using VisualStudio 2005, asp.net 2.0: > > What do I put in my Web.Config to avoid hard coding the: myserveraddress.com? > > The following shows how I have hard coded it without having the value > in the > we.config, and it works. However, I would like to place it in my web.config > file, and then just get the value from the web.config? > > Can someone tell me what I need to add to the web.config > > //send the message > System.Net.Mail.SmtpClient smtp = new > System.Net.Mail.SmtpClient("smtp.myserveraddress.c om"); > smtp.Send(mail);
Yes, thank you.
Using the web.config setting, what change needs to be made to the following
code.
//send the message > System.Net.Mail.SmtpClient smtp = new > System.Net.Mail.SmtpClient("smtp.myserveraddress.c om"); > smtp.Send(mail);
"Swanand Mokashi" wrote:
Add the <mailSettings> block in <system.net> block in the web.config file. for e.g. <system.net> <mailSettings> <smtp from="fr**@test.com"> <network host="127.0.0.1" password="" userName="" /> </smtp> </mailSettings> </system.net>
-- Swanand Mokashi Microsoft Certified Solution Developer (.NET) - Early Achiever Microsoft Certified Application Developer (.NET)
http://www.dotnetgenerics.com/ DotNetGenerics.com -- anything and everything about Microsoft .NET technology ...
http://www.swanandmokashi.com/ http://www.swanandmokashi.com/HomePage/WebServices/ Home of the Stock Quotes, Quote of the day and Horoscope web services "theWizard1" <th********@discussions.microsoft.com> wrote in message news:FD**********************************@microsof t.com... The solution offered is more than I need.
Can someone simply provide a sample of the lines that I need to add to the web.config for asp.net 2.0.
"sloan" wrote:
check my blog: http://spaces.msn.com/sholliday/ 2/8/2006 entry
I wrote a very nice (if I do say so my self) for having lots of flexibility with smtp server settings.
There is a 2.0 and 1.1 example.
"theWizard1" <th********@discussions.microsoft.com> wrote in message news:64**********************************@microsof t.com... > Using VisualStudio 2005, asp.net 2.0: > > What do I put in my Web.Config to avoid hard coding the: myserveraddress.com? > > The following shows how I have hard coded it without having the value > in the > we.config, and it works. However, I would like to place it in my web.config > file, and then just get the value from the web.config? > > Can someone tell me what I need to add to the web.config > > //send the message > System.Net.Mail.SmtpClient smtp = new > System.Net.Mail.SmtpClient("smtp.myserveraddress.c om"); > smtp.Send(mail);
Comment the first line where you are setting the smtpClient
and replace it by just
SmtpClient client = new SmtpClient();
System.Net.Mail reads SMTP configuration data out of the standard .NET
configuration system (so for ASP.NET applications you'd configure this in
your application's web.config file)
Check Scott Guthrie's post here : http://weblogs.asp.net/scottgu/archi...10/432854.aspx
--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET) http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ... http://www.swanandmokashi.com/ http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com... Yes, thank you. Using the web.config setting, what change needs to be made to the following code.
//send the message >> > System.Net.Mail.SmtpClient smtp = new >> > System.Net.Mail.SmtpClient("smtp.myserveraddress.c om"); >> > smtp.Send(mail);
"Swanand Mokashi" wrote:
Add the <mailSettings> block in <system.net> block in the web.config file. for e.g. <system.net> <mailSettings> <smtp from="fr**@test.com"> <network host="127.0.0.1" password="" userName="" /> </smtp> </mailSettings> </system.net>
-- Swanand Mokashi Microsoft Certified Solution Developer (.NET) - Early Achiever Microsoft Certified Application Developer (.NET)
http://www.dotnetgenerics.com/ DotNetGenerics.com -- anything and everything about Microsoft .NET technology ...
http://www.swanandmokashi.com/ http://www.swanandmokashi.com/HomePage/WebServices/ Home of the Stock Quotes, Quote of the day and Horoscope web services "theWizard1" <th********@discussions.microsoft.com> wrote in message news:FD**********************************@microsof t.com... > The solution offered is more than I need. > > Can someone simply provide a sample of the lines that I need to add to > the > web.config for asp.net 2.0. > > "sloan" wrote: > >> check my blog: >> http://spaces.msn.com/sholliday/ 2/8/2006 entry >> >> I wrote a very nice (if I do say so my self) for having lots of >> flexibility >> with smtp server settings. >> >> There is a 2.0 and 1.1 example. >> >> >> >> >> "theWizard1" <th********@discussions.microsoft.com> wrote in message >> news:64**********************************@microsof t.com... >> > Using VisualStudio 2005, asp.net 2.0: >> > >> > What do I put in my Web.Config to avoid hard coding the: >> myserveraddress.com? >> > >> > The following shows how I have hard coded it without having the >> > value >> > in >> the >> > we.config, and it works. However, I would like to place it in my >> web.config >> > file, and then just get the value from the web.config? >> > >> > Can someone tell me what I need to add to the web.config >> > >> > //send the message >> > System.Net.Mail.SmtpClient smtp = new >> > System.Net.Mail.SmtpClient("smtp.myserveraddress.c om"); >> > smtp.Send(mail); >> >> >>
Thank you. It all works. You made it so simple.
"Swanand Mokashi" wrote: Comment the first line where you are setting the smtpClient and replace it by just
SmtpClient client = new SmtpClient();
System.Net.Mail reads SMTP configuration data out of the standard .NET configuration system (so for ASP.NET applications you'd configure this in your application's web.config file)
Check Scott Guthrie's post here : http://weblogs.asp.net/scottgu/archi...10/432854.aspx
-- Swanand Mokashi Microsoft Certified Solution Developer (.NET) - Early Achiever Microsoft Certified Application Developer (.NET)
http://www.dotnetgenerics.com/ DotNetGenerics.com -- anything and everything about Microsoft .NET technology ...
http://www.swanandmokashi.com/ http://www.swanandmokashi.com/HomePage/WebServices/ Home of the Stock Quotes, Quote of the day and Horoscope web services "theWizard1" <th********@discussions.microsoft.com> wrote in message news:18**********************************@microsof t.com... Yes, thank you. Using the web.config setting, what change needs to be made to the following code.
//send the message >> > System.Net.Mail.SmtpClient smtp = new >> > System.Net.Mail.SmtpClient("smtp.myserveraddress.c om"); >> > smtp.Send(mail);
"Swanand Mokashi" wrote:
Add the <mailSettings> block in <system.net> block in the web.config file. for e.g. <system.net> <mailSettings> <smtp from="fr**@test.com"> <network host="127.0.0.1" password="" userName="" /> </smtp> </mailSettings> </system.net>
-- Swanand Mokashi Microsoft Certified Solution Developer (.NET) - Early Achiever Microsoft Certified Application Developer (.NET)
http://www.dotnetgenerics.com/ DotNetGenerics.com -- anything and everything about Microsoft .NET technology ...
http://www.swanandmokashi.com/ http://www.swanandmokashi.com/HomePage/WebServices/ Home of the Stock Quotes, Quote of the day and Horoscope web services "theWizard1" <th********@discussions.microsoft.com> wrote in message news:FD**********************************@microsof t.com... > The solution offered is more than I need. > > Can someone simply provide a sample of the lines that I need to add to > the > web.config for asp.net 2.0. > > "sloan" wrote: > >> check my blog: >> http://spaces.msn.com/sholliday/ 2/8/2006 entry >> >> I wrote a very nice (if I do say so my self) for having lots of >> flexibility >> with smtp server settings. >> >> There is a 2.0 and 1.1 example. >> >> >> >> >> "theWizard1" <th********@discussions.microsoft.com> wrote in message >> news:64**********************************@microsof t.com... >> > Using VisualStudio 2005, asp.net 2.0: >> > >> > What do I put in my Web.Config to avoid hard coding the: >> myserveraddress.com? >> > >> > The following shows how I have hard coded it without having the >> > value >> > in >> the >> > we.config, and it works. However, I would like to place it in my >> web.config >> > file, and then just get the value from the web.config? >> > >> > Can someone tell me what I need to add to the web.config >> > >> > //send the message >> > System.Net.Mail.SmtpClient smtp = new >> > System.Net.Mail.SmtpClient("smtp.myserveraddress.c om"); >> > smtp.Send(mail); >> >> >> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Rajesh Abraham |
last post by:
I have an assembly, which is reading some values from the
App.Config file. It works fine when used with a Win Forms
project.
Now I am trying to use the same assembly in a Windows
Service...
|
by: Anna |
last post by:
I added a small Web.Config file to the root of my website so that I
could view errors on a machine other than the server:
<configuration>
<system.web>
<customErrors mode="Off" />
</system.web>...
|
by: feng |
last post by:
Hi,
We just converted our VB.Net Windows exe project from
VS.Net 2002 to VS.Net 2003 and ran into a problem. the
MyApp.exe.config file that we use for our customized
configuration settings is...
|
by: David Thole |
last post by:
Hey all,
I'm still very new at all this, but am going through the ASP.net 2.0
unleashed book, first chapter and trying to program my own little form
emailer for fun. I tried following the code...
|
by: howardr101 |
last post by:
Hi,
Have hunted around on the groups and can't find anything, hence.
I've tried this against 2 mail servers (mailtraq and hmailserver) and
it occus with both.
The problems seems to be that...
|
by: Sammy |
last post by:
I am using the following code on a company that hosts our web site. I have
noticed lately that their mail server/smtp is unavailable several times a
minute for a second or two. This is causing my...
|
by: Peted |
last post by:
Hi,
im wanting to store some custom text strings in the app.config file of
a c# app, to be retreived and updated when the app runs.
using c# 2005 express
in my testing i am using the code...
|
by: =?Utf-8?B?VG9yc3Rlbg==?= |
last post by:
Hi,
I have a problem sending mails with the SmtpClient class. It's strange -
after I boot the pc and start the program I can send mails many times. After
I close the program and start it again...
|
by: BigDave |
last post by:
Hi,
I'm having problems with SmtpClient. I have the following set in my
web.config:
<configuration>
<system.net>
<mailSettings>
<smtp>
<network host="mysmtp" port="25" userName="myuser"
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |