I inherit and modify the System.Net.MailMessage class for use in a web service. I need to save it by name MailMessage for other reasons. When I use this in the code below, I get the error below.
The types System.Net.Mail.MailMessage and TestWebService.MailMessage use the XML type name MailMessage from the namespace http://tempuri.org/. Use the XML attributes to specify a unique XML name and / or namespace for this type. "
I believe that I need to add the XMLRoot and Type attributes, but I cannot figure out the right combination. What do I need to do to resolve this error?
namespace TestWebService { [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] public class Service1 : System.Web.Services.WebService { [WebMethod] public string Test(MailMessage emailMessage) { return "It Worked!"; } } } namespace TestWebService { public class MailMessage : System.Net.Mail.MailMessage { public MailMessage() : base() { } } }
source share