Tuesday, March 13, 2012

SmtpServer - webconfig?

Is it possible to store the SmtpServer in the webconfig... For testing reasons, I have two different SmtpServers.

For example... store "11.1.11.11"

System.Web.Mail.SmtpMail.SmtpServer = "11.1.11.11"Hi,

You can very well store it in the web.config using the appsettings,

<configuration
<appSettings>
<add key="SMTPServer" value="11.1.11.11"/>
</appSettings
</configuration

then you can access it in your code as

SmtpMail.SmtpServer=ConfigurationSettings.AppSettings["SMTP-Server"];

Hope it helps.
thankyou very much :)
You are welcome

0 comments:

Post a Comment