I'm doing a code of sending email to a reciepnt, i did the behind cod and the SMTP configuraiton but it when adding the statement to the web.config page it gives me an Error.
"Error 2 Only one <configSections> element allowed per config file and if present must be the first child of the root <configuration> element. C:\Documents and Settings\User\My Documents\Visual Studio 2008\WebSites\WebSite2\web.config 21 "
I'm adding the following code inside the <configuration block as mentoined in another topic in the forum>
Seems like you just put your <system.net> section in the wrong spot. For safety just place your <system.net> stuff just above the closing </configuration> tag
mE1987
Member
6 Points
9 Posts
web.config Error msg when doing sending mail code
Mar 27, 2010 03:20 PM|LINK
Hi,
I'm doing a code of sending email to a reciepnt, i did the behind cod and the SMTP configuraiton but it when adding the statement to the web.config page it gives me an Error.
"Error 2 Only one <configSections> element allowed per config file and if present must be the first child of the root <configuration> element. C:\Documents and Settings\User\My Documents\Visual Studio 2008\WebSites\WebSite2\web.config 21 "
I'm adding the following code inside the <configuration block as mentoined in another topic in the forum>
<system.net>
<mailSettings>
<smtp from="username@DomainName">
<network host="SMTPServerName" port="25" userName="username" password="secret" defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>
any advice?
"Asp.net 2.0"
h.zahed@live...
Contributor
3171 Points
514 Posts
Re: web.config Error msg when doing sending mail code
Mar 27, 2010 06:15 PM|LINK
Hi,
Please copy the whole content of your web.config file.
MCP-MCTS-MCPD
Mark the post as Answer, if it helped you in solving your question.
RichardY
Star
8376 Points
1573 Posts
Re: web.config Error msg when doing sending mail code
Mar 27, 2010 06:25 PM|LINK
Seems like you just put your <system.net> section in the wrong spot. For safety just place your <system.net> stuff just above the closing </configuration> tag
kanasz.rober...
Contributor
3242 Points
523 Posts
Re: web.config Error msg when doing sending mail code
Mar 27, 2010 07:26 PM|LINK
Hi,
check in IIS, whether you application is running under asp.net 2.0. if not, set it to 2.0
Regards
Robert
- SQL Server 2008, Database Development
- SQL Server 2008, Implementation and Maintenance
MCPD - ASP.NET Developer 3.5
- Web Developer 4
MCITP - Database Administrator 2008
- Database Developer 2008
mE1987
Member
6 Points
9 Posts
Re: web.config Error msg when doing sending mail code
Mar 28, 2010 08:06 PM|LINK
the content of web.config :
<?xml version="1.0"?>
<configuration>
<system.net>
<mailSettings>
<smtp from="username@DomainName">
<network host="SMTPServerName" port="25" userName="username" password="secret" defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>
<configSections>
</configuration>
kanasz.rober...
Contributor
3242 Points
523 Posts
Re: web.config Error msg when doing sending mail code
Mar 28, 2010 08:20 PM|LINK
Hi, did you try check .net framework in iis?
- SQL Server 2008, Database Development
- SQL Server 2008, Implementation and Maintenance
MCPD - ASP.NET Developer 3.5
- Web Developer 4
MCITP - Database Administrator 2008
- Database Developer 2008
mE1987
Member
6 Points
9 Posts
Re: web.config Error msg when doing sending mail code
Mar 28, 2010 08:27 PM|LINK
Hi..
Thanks for following up,. how to check .net framework in iis ??, i tried to find it in iis settings but couldn't.
kanasz.rober...
Contributor
3242 Points
523 Posts
Re: web.config Error msg when doing sending mail code
Mar 28, 2010 08:34 PM|LINK
hi,
open IIS management console
right click on your application
click on properties and than selecy asp.net tab and check, whether in field asp.net version is 2.0.5....
- SQL Server 2008, Database Development
- SQL Server 2008, Implementation and Maintenance
MCPD - ASP.NET Developer 3.5
- Web Developer 4
MCITP - Database Administrator 2008
- Database Developer 2008
kanasz.rober...
Contributor
3242 Points
523 Posts
Re: web.config Error msg when doing sending mail code
Mar 28, 2010 08:35 PM|LINK
this picture could help you: http://support.citrix.com/article/html/images/CTX117194-1.gif
- SQL Server 2008, Database Development
- SQL Server 2008, Implementation and Maintenance
MCPD - ASP.NET Developer 3.5
- Web Developer 4
MCITP - Database Administrator 2008
- Database Developer 2008
mE1987
Member
6 Points
9 Posts
Re: web.config Error msg when doing sending mail code
Mar 28, 2010 08:41 PM|LINK
Yes, it's 2.0.50727