If this is not the URL, "127.0.0.1", of the mail server it will not work. The SmtpClient must point to the actual mail server.
Main Topics
Browse All TopicsI'm really new at this stuff so please bear with me. I just need to send an e-mail when a button is pushed on my ASPX page that I wrote up. I keep being told to use code behind pages, but I don't quite understand much about this. I don't understand how to "call" the code behind procedure when the button is pushed.
here's the line i used to reference the Code Behind File
<%@ Page Language="C#" CodeFile="../InsertCrap.cs
Here is the code i have on the code behind page. I keep getting errors every time I try to change something or load the page.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Could be that this is because of the script runat=server on your aspx page itsself. Might get your page confused as to where to get the code from. as far as I can see though, that looks ok.
FernandoSoto is right about the mailserver part, but that doesn't help you with the error you are getting.
Try moving:
protected void FormView_ItemInserting(obj
e.Values["County_Main"] = ((DropDownList)(InputForm.
}
to your codebehind.
Hi GravitaZ24;
By the sounds of the error you all ready have a class called Program14. If this is a partial class then change the following line in your code:
From this
class Program14
To this
public partial class Program14
and then you should remove the function, static void Main(string[] args), because it is most likely in the other file that has the class Program14.
Fernando
I'm getting these errors now
Server Error in '/My Web Sites' Application.
--------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
Source Error:
Line 9: namespace Mail
Line 10: {
Line 11: public partial class Program
Line 12: {
Line 13: static void PlainText()
Source File: c:\Documents and Settings\ljm0ft8\My Documents\My Web Sites\InsertCrap.cs Line: 11
Show Detailed Compiler Output:
C:\WINDOWS> "C:\WINDOWS\Microsoft.NET\
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.3053
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.
c:\Documents and Settings\ljm0ft8\My Documents\My Web Sites\InsertCrap.cs(912305
c:\WINDOWS\Microsoft.NET\F
c:\WINDOWS\Microsoft.NET\F
c:\WINDOWS\Microsoft.NET\F
c:\WINDOWS\assembly\GAC_32
The original error was, "Compiler Error Message: CS0260: Missing partial modifier on declaration of type 'Program14'; another partial declaration of this type exists". referencing this code:
namespace Mail
{
class Program14
{
static void PlainText()
I stated that it sounds like you all ready have a class by the name Program14.
If that is the case then you can make this part of the class by adding the words "public partial" before the word class as shown below:
namespace Mail
{
public partial class Program14
{
static void PlainText()
Or you could just make this a new class by changing the name Program14 to something else not all ready in use.
FernandoSoto, as far as I can tell from the original code, that's what he used to have. So Gravita, if you canged the public partial class Program14 into public partial class Program, make sure the cs page itsself has: Inherits Program or it will give this error you are getting. You didn't show us the code you have for that at the moment, so it might well be that you didn't change that line.
Regards,
Max.
Business Accounts
Answer for Membership
by: DreamMasterPosted on 2008-09-03 at 08:07:46ID: 22378090
change this line: mail.To.Add("jonmori@conso lenergy.co m");
lenergy.co m");
to mail.To.Add(New MailAddress("jonmori@conso
That should at least work...
"I keep getting errors every time I try to change something or load the page"
Do you mean you're getting error in Visual Studio itsself?