I am creating a contact us form using VB for a website but don't know how to specify SMTP setting(user name, password etc...) in webconfig file and using those setting in Contact us form.
In your web.config file, add an element called <appSettings> between <configuration> and <system.web>, inside the appSettings element, use the <add/> element to add variables:
You can access these values by the System.Configuration.ConfigurationSettings class' static AppSettings property. Like this:
using System.Configuration;
....
public class MyPage : System.Web.Page
{
public void Page_OnLoad()
{
Response.Write(ConfigurationSettings.AppSettings.Get("MyKey"));
}
....
}
shashikant20...
Member
7 Points
41 Posts
Contact Us Form in ASP.Net (VB) with smtp setting in webconfig
Feb 20, 2013 11:55 PM|LINK
hi,
I am creating a contact us form using VB for a website but don't know how to specify SMTP setting(user name, password etc...) in webconfig file and using those setting in Contact us form.
Kindly explain with some sample code or example.
Thanks,
Shashikant
evanburen
Member
401 Points
201 Posts
Re: Contact Us Form in ASP.Net (VB) with smtp setting in webconfig
Feb 21, 2013 12:32 AM|LINK
In your web.config file, add an element called <appSettings> between <configuration> and <system.web>, inside the appSettings element, use the <add/> element to add variables:
<configuration>
<appSettings>
<add key="MyKey" value="SMTPValue"/>
</appSettings>
<system.web>
</configuration>
You can access these values by the System.Configuration.ConfigurationSettings class' static AppSettings property. Like this:
using System.Configuration; .... public class MyPage : System.Web.Page { public void Page_OnLoad() { Response.Write(ConfigurationSettings.AppSettings.Get("MyKey")); } .... }shashikant20...
Member
7 Points
41 Posts
Re: Contact Us Form in ASP.Net (VB) with smtp setting in webconfig
Feb 21, 2013 04:04 AM|LINK
Thanks for prompt reply.
The code you wrote is in C# where as I am using VB so, please send me the VB code with an Example.
geniusvishal
Star
14016 Points
2784 Posts
Re: Contact Us Form in ASP.Net (VB) with smtp setting in webconfig
Feb 21, 2013 04:46 AM|LINK
Refer this:
http://blog.shawnhyde.com/post/2009/06/12/How-to-create-a-basic-aspnet-contact-form-in-vbnet.aspx
My Website
www.dotnetvishal.com
ramiramilu
All-Star
95285 Points
14072 Posts
Re: Contact Us Form in ASP.Net (VB) with smtp setting in webconfig
Feb 21, 2013 05:39 AM|LINK
check this tutorial - http://www.intstrings.com/ramivemula/asp-net/ajax-html-editor-based-contact-form-inside-updatepanel-along-with-updateprogress/
thanks,
JumpStart