Wrox Programmer Forums
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 13th, 2007, 12:24 PM
Registered User
 
Join Date: Sep 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need to send email

Hi.
Firstly, I'm not sure I'm posting this query in the correct forum. Apologies if I got it wrong.
I am designing a simple web page using C# in Microsoft Visual Web Developer. All I want is a form witha few fields and a button. On clicking this button I want to generate an email to me (administrator).
I have searched for various solutions on the internet and have tried most of them.

No matter what solution I try (to send email when button clicked) I get the same error:

" Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. "

When I search for this error, the comments all relate to web farms etc. (whatever they are).

Can I just explain a little bit here (please be patient).

I suspect the problem is related to the fact that I am testing / running the code on my PC - i.e. not uploading it to a server.

An example of the code that I'm using (when button clicked) is:

*********************************************

<%@ Import Namespace="System.Net.Mail" %>

<script runat="server">

    protected void buttonSend_Click(object sender, EventArgs e)
    {
        MailAddress from = new MailAddress("email1@myserver.com");
        MailAddress to = new MailAddress("email2@myserver.com");
        MailMessage message = new MailMessage(from, to);
        message.Subject = "Using the SmtpClient class.";
        message.Body = @"Using this feature, you can send an e-mail message from an application very easily.";
        SmtpClient client = new SmtpClient("localhost");
        client.Send(message);
    }
</script>

*************************************

where email1 and email2 are two of my own email addresses. Also, instead of "localhost" I'ce also tried "mail.myserver.com" and "smtp.myserver.com" (where myserver is my real ISP).

Also, I've updated my web.config a few times with various combinations of parameters.

No matter what solutions I find and try, I keep getting the same error when I click on the button. As I say, I'm guessing it might be because I'm trying to test the code on my PC. Uploading to a server is not an option at the moment.

Have you any suggestions. My other option is to take 3 months out and study C# and Visual Web Developer in depth - but I'm hoping just to get past this hurdle and move on for now...

Regards,



Garrett Brennan








Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send email abiye49 Excel VBA 1 January 10th, 2007 03:32 PM
Send by email tsimsha Classic ASP Databases 1 October 1st, 2005 03:03 AM
To send an email Danny_n BOOK: Excel 2003 VBA Programmer's Reference 0 January 12th, 2005 08:33 AM
Send email Danny_n BOOK: Excel 2003 VBA Programmer's Reference 0 January 12th, 2005 08:32 AM
send email X-Ken VS.NET 2002/2003 8 July 2nd, 2004 06:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.