473,804 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MailSettings code generates VS2005 error in web.config

Hi all,
Here's a good one. I'm just trying to set up simple email configuration in
web.config so that I can move my site from my development machine to the
production server. I didn't need to pass an ID and Password to the smtp
server at my office, but the Web server I'm using requires it. So I look
into the online help and find no samples of how to set up that type of
configuration. All examples assume default network credentials.

I find the code below in VS help and copy it into my web.config.

<configuratio n>
<system.net>
<mailSettings >
<smtp deliveryMethod= "network">
<network
host="localhost "
port="25"
defaultCredenti als="true"
/>
</smtp>
</mailSettings>
</system.net>
</configuration>

Now I get an error on the line <smtp deliveryMethod= "network">. ..
"The deliverymethod attribute is invalid - the value 'network' is invalid
according to its datatype 'NmToken' - the enumeration constraint failed."

It seems that very often even the simplest of tasks can be like pulling
teeth with .NET.
Instead of getting productive work done, I will now be researching another
cryptic VS error message.
What did I do wrong? Does anyone know?

Thanks for any help.

Apr 30 '07 #1
3 6754
Might not be meaningful, but you're missing a parameter ...

<smtp deliveryMethod= "network" from="jo***@pow erlist.com">

You *are* running an ASP.NET 2.0 app, aren't you ?
This only works in ASP.NET 2.0...


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"John Kotuby" <jo***@powerlis t.comwrote in message news:eB******** *****@TK2MSFTNG P04.phx.gbl...
Hi all,
Here's a good one. I'm just trying to set up simple email configuration in web.config so that I
can move my site from my development machine to the production server. I didn't need to pass an ID
and Password to the smtp server at my office, but the Web server I'm using requires it. So I look
into the online help and find no samples of how to set up that type of configuration. All examples
assume default network credentials.

I find the code below in VS help and copy it into my web.config.

<configuratio n>
<system.net>
<mailSettings >
<smtp deliveryMethod= "network">
<network
host="localhost "
port="25"
defaultCredenti als="true"
/>
</smtp>
</mailSettings>
</system.net>
</configuration>

Now I get an error on the line <smtp deliveryMethod= "network">. ..
"The deliverymethod attribute is invalid - the value 'network' is invalid according to its
datatype 'NmToken' - the enumeration constraint failed."

It seems that very often even the simplest of tasks can be like pulling teeth with .NET.
Instead of getting productive work done, I will now be researching another cryptic VS error
message.
What did I do wrong? Does anyone know?

Thanks for any help.


Apr 30 '07 #2
Thanks Juan...
Yes I am using ASP.NET 2.0

But good old Intellisense came to the rescue right after my rant.
The accepted syntax is:
<smtp deliveryMethod= "Network">

Isn't that a hoot? Just capitalize Network in it gets accepted.

But during my research I found out that back in May 2006 there was a bug in
System.Net.Mail

If you were hard coding the credentials and used the syntax...

UseDefaultCrede ntials = false

The ID and Password you coded would be ignored and not sent to the smtp
server.
The fix was to NOT refer to UseDefaultCrede ntials because it is false by
default.

Maybe this bit of information will help somebody else if the bug has not yet
been fixed.

So to be safe I am leaving...
defaultCredenti als="false"
Out of my web.config for the time being.

Thanks again...

P.S. My apologies, I sent the first reply back to you directly and just
corrected my mistake.
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:eU******** *****@TK2MSFTNG P05.phx.gbl...
Might not be meaningful, but you're missing a parameter ...

<smtp deliveryMethod= "network" from="jo***@pow erlist.com">

You *are* running an ASP.NET 2.0 app, aren't you ?
This only works in ASP.NET 2.0...


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"John Kotuby" <jo***@powerlis t.comwrote in message
news:eB******** *****@TK2MSFTNG P04.phx.gbl...
>Hi all,
Here's a good one. I'm just trying to set up simple email configuration
in web.config so that I can move my site from my development machine to
the production server. I didn't need to pass an ID and Password to the
smtp server at my office, but the Web server I'm using requires it. So I
look into the online help and find no samples of how to set up that type
of configuration. All examples assume default network credentials.

I find the code below in VS help and copy it into my web.config.

<configuration >
<system.net>
<mailSettings >
<smtp deliveryMethod= "network">
<network
host="localhost "
port="25"
defaultCredenti als="true"
/>
</smtp>
</mailSettings>
</system.net>
</configuration>

Now I get an error on the line <smtp deliveryMethod= "network">. ..
"The deliverymethod attribute is invalid - the value 'network' is invalid
according to its datatype 'NmToken' - the enumeration constraint failed."

It seems that very often even the simplest of tasks can be like pulling
teeth with .NET.
Instead of getting productive work done, I will now be researching
another cryptic VS error message.
What did I do wrong? Does anyone know?

Thanks for any help.





Apr 30 '07 #3
re:
!Isn't that a hoot? Just capitalize Network in it gets accepted.

Sometimes it's the little things which trip us.

:-)

re:
!The fix was to NOT refer to UseDefaultCrede ntials because it is false by default.

Interesting.

re:
!Maybe this bit of information will help somebody else if the bug has not yet been fixed.

I'm sure it will.
Thanks for posting the heads-up!

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"John Kotuby" <jo***@powerlis t.comwrote in message news:u6******** ******@TK2MSFTN GP05.phx.gbl...
Thanks Juan...
Yes I am using ASP.NET 2.0

But good old Intellisense came to the rescue right after my rant.
The accepted syntax is:
<smtp deliveryMethod= "Network">

Isn't that a hoot? Just capitalize Network in it gets accepted.

But during my research I found out that back in May 2006 there was a bug in
System.Net.Mail

If you were hard coding the credentials and used the syntax...

UseDefaultCrede ntials = false

The ID and Password you coded would be ignored and not sent to the smtp
server.
The fix was to NOT refer to UseDefaultCrede ntials because it is false by
default.

Maybe this bit of information will help somebody else if the bug has not yet
been fixed.

So to be safe I am leaving...
defaultCredenti als="false"
Out of my web.config for the time being.

Thanks again...

P.S. My apologies, I sent the first reply back to you directly and just corrected my mistake.
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:eU******** *****@TK2MSFTNG P05.phx.gbl...
>Might not be meaningful, but you're missing a parameter ...

<smtp deliveryMethod= "network" from="jo***@pow erlist.com">

You *are* running an ASP.NET 2.0 app, aren't you ?
This only works in ASP.NET 2.0...


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============== =============== ======
"John Kotuby" <jo***@powerlis t.comwrote in message news:eB******** *****@TK2MSFTNG P04.phx.gbl...
>>Hi all,
Here's a good one. I'm just trying to set up simple email configuration in web.config so that I
can move my site from my development machine to the production server. I didn't need to pass an
ID and Password to the smtp server at my office, but the Web server I'm using requires it. So I
look into the online help and find no samples of how to set up that type of configuration. All
examples assume default network credentials.

I find the code below in VS help and copy it into my web.config.

<configuratio n>
<system.net>
<mailSettings >
<smtp deliveryMethod= "network">
<network
host="localhost "
port="25"
defaultCredenti als="true"
/>
</smtp>
</mailSettings>
</system.net>
</configuration>

Now I get an error on the line <smtp deliveryMethod= "network">. ..
"The deliverymethod attribute is invalid - the value 'network' is invalid according to its
datatype 'NmToken' - the enumeration constraint failed."

It seems that very often even the simplest of tasks can be like pulling teeth with .NET.
Instead of getting productive work done, I will now be researching another cryptic VS error
message.
What did I do wrong? Does anyone know?

Thanks for any help.






Apr 30 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1152
by: gorden blom | last post by:
Hi, I'm a student who's working on a school project about ASP.NET / C#. I'm having some problems with my class. I want to create an ArrayList filled with results from a DataReader. It gives me the following error: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
0
1167
by: Lloyd Dupont | last post by:
Hi! I'm a newbie ;-) I started to write an excessively simple ASP.NET "utility" web app, named WebSite1. Inside of it I'm using FreeTextBox (http://www.freetextbox.com) Then I modified the Web.config file as follow (to recognize the tag FTB): === <system.web> <pages> <controls> <add tagPrefix="FTB" namespace="FreeTextBoxControls" assembly="FreeTextBox"/>
2
1326
by: VB Programmer | last post by:
When I change my "from" and "host" I get a slew of web.config messages... Here's the mailsettings... <system.net> <mailSettings> <smtp from="me@mydomain.com"> <network host="mail.mydomain.com" /> </smtp> </mailSettings> </system.net>
40
2807
by: GTi | last post by:
Is there any source code documentation tools available for Visual Studio 2005 ? I have created a LIB that must be documented. Must I do it by hand or is it some kind of tools to pre document my source code?
2
2063
by: Rob Dob | last post by:
Hi, How do I go about installing another Web Site Project inside my existing VS2005 website project. I currently have both a forum WSP and my main WSP application within the same solution. Both compile and run without error. However they are separate applications and I would like to have them together in order to make use of my masterpages, and share controls between. Do I need to combine the web.config files? I figured I would just...
1
1384
by: Franklin M. Gauer III | last post by:
In VS2003 I used to be able to drag a SQL Server table from Server Explorer onto my webservice (in design mode) and it would automatically create a DataAdapter for me. This doesn't work in VS2005 anymore (crap) - is this by design? Does anyone know? Now if you create a DataAdapter in VS2005 (on a webservice project) it generates the SQL statements and puts them in a .RESX file (i.e. the UPDATE and INSERT SQL command text). Then the...
10
1746
by: Ivan Vecerina | last post by:
Here's a relatively simple code snippet: #include <memory> class Base { public: Base(); virtual ~Base(); virtual void f(int a, char const* name);
3
3683
by: David Prentice | last post by:
I am having dificulty debugging an ASP.NET Ajax (Novemver CTP) app on windows vista RTM. I have found the following interesting facts but cannot join the dots . . If my application is configured to run in the Classic .NET App pool, when I hit F5 in visual Studio 2005 I can successfully debug my application, however partial rendering using an update panel does not work (I have discovered that the script resource handler is causing a...
0
2474
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all I have an app.config file for my App, and use MailSettings Section. I can modify AppSettings and ConnectionsStrings , and then save app.config.
0
9715
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10603
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10099
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3003
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.