Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 13th, 2007, 12:24 PM
Registered User
 
Join Date: Sep 2007
Location: , , .
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



Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:05 PM.


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