Şub 23 2011

web.config den mail ayarlarını okuma

Category: c#by_derkan @ 11:11

    public static MailSettingsSectionGroup MailAyar()
    {
        Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
        return(MailSettingsSectionGroup)config.GetSectionGroup("system.net/mailSettings");
    }

 

 

Response.Write("host: " + MailAyar().Smtp.Network.Host + "<br />");
Response.Write("port: " +
MailAyar().Smtp.Network.Port + "<br />");
Response.Write("Username: " +
MailAyar().Smtp.Network.UserName + "<br />");
Response.Write("Password: " +
MailAyar().Smtp.Network.Password + "<br />");
Response.Write("from: " +
MailAyar().Smtp.From + "<br />");

 

http://www.dotnetspider.com/forum/179482-how-get-mail-settings-from-web-config-file.aspx

Tags:

Yorumlar

Yorum ekle


(Gravatar simgesini gösterecek)

  Country flag

biuquote
  • Yorum
  • Canlı önizleme
Loading