CS1026: ) expected

Hello,

I am trying to slowly transition from ASP to ASP.NET.  I am very unfamiliar with the .NET at this point.  A book I am reading provided the following sample code.  When I attempted to use it, I got the following error:

Compiler Error Message: CS1026: ) expected

Here is the sample code - note the error on line 5:
=============
<%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="System.Web.Mail" %>

<Script runat="server">
Sub Button_Click(s As Object, e As EventArgs) '***The error occurs on this line
  SmtpMail.Send( _
    mailfrom.Text, _
    mailto.Text, _
    mailsubject.Text, _
    mailbody.Text )
End Sub
</Script>

<html>
<head><title>SendMail.aspx</title></head>
<body>

<h1>Send Mail:</h1>
<form runat="Server">

<b>From:</b>
<br>
<asp:TextBox
  ID="mailfrom"
  Columns="50"
  Runat="Server" />
<p>
<b>To:</b>
<br>
<asp:TextBox
  ID="mailto"
  Columns="50"
  Runat="Server" />
<p>
<b>Subject:</b>
<br>
<asp:TextBox
  ID="mailsubject"
  Columns="50"
  Runat="Server" />
<p>
<b>Body:</b>
<br>
<asp:TextBox
  ID="mailbody"
  TextMode="Multiline"
  Columns="50"
  Rows="10"
  Runat="Server" />
<p>
<asp:Button
  Text="Send!"
  OnClick="Button_Click"
  Runat="Server" />
</form>

</body>
</html>
==============
lexcioAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Justin_WCommented:
Your aspx is expecting the script to be in C#.  To fix it, change this:
   <%@ Page Language="C#" Debug="true" %>

to this:
   <%@ Page Language="vb" Debug="true" %>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lexcioAuthor Commented:
Good catch,

Now line 6 is causing the problem.

System.Runtime.InteropServices.COMException: The "SendUsing" configuration value is invalid.

Line 6:  
SmtpMail.Send( _

Any ideas?
Justin_WCommented:
This sounds like an issue for a separate question.  However:

You probably need to set the SMTP server explicitly before calling the SmtpMail.Send method.  E.g.:
   SmtpMail.SmtpServer = "smtp.YourProvider.com"
lexcioAuthor Commented:
ok.  sure.  let me set up a separate post... & you can elaborate there.
lexcioAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.