I wrote this in my web.config now how to access host,port in my code
I am using like this but it is unable to read pls help me
string smtphost = ConfigurationManager.AppSettings["host"].ToString();
<mailSettings>
<smtp from="mail.crmprocorp.com" deliveryMethod="Network">
<network
defaultCredentials="false"
enableSsl="false"
host="smtp.gmail.com"
port="25"
password="password"
userName="xyz@gmail.com"/>
</smtp>
</mailSettings>
You have to use the
ConfigurationManagerand its methodGetSectionto do this.MSDN docs:
http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.getsection.aspx