Using Import Name Spaces

Posted on 2005-04-20
Medium Priority
Last Modified: 2010-04-07
I am working on ImportNameSpaces, here is the code...

<%@Import NameSpace="System.Web.Mail"%>

<Script runat="server">

Sub Page_Load
  Dim mailMessage As SmtpMail
  mailMessage.Send( _
    "Sending Mail!",_
End Sub

  <h2>Email Sent!</h2>

I am getting an error only when I try to dispaly in the browser but not in design mode in Visual Studio.
Here is one error I get when I take out the underscore....(
"Sending Mail!","Hello!"_ )

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

Source Error:

Line 6:    Dim mailMessage As SmtpMail
Line 7:    
Line 8:    mailMessage.Send("bob@somewhere.com","alice@somewhere.com","Sending Mail!","Hello!" )
Line 9:  End Sub
Line 10: </Script>

Source File: c:\inetpub\wwwroot\simple001\ImportNameSpace.aspx    Line: 8
Now if I put  the underscore back in  I get this error...
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: BC30201: Expression expected.

Source Error:


Line 6:    Dim mailMessage As SmtpMail
Line 7:    
Line 8:    mailMessage.Send(
Line 9:    "bob@somewhere.com",_
Line 10:   "alice@somewhere.com",_

Source File: c:\inetpub\wwwroot\simple001\ImportNameSpace.aspx    Line: 8

Can you explain what it is I am doing wrong. I have had someone else look at it  and they dont see the error either.

Any help would be wonderful.
Thanks in Advance.
Question by:mathieu_cupryk
  • 3
  • 2

Expert Comment

ID: 13823677
u should have a space between the comma and the _
LVL 33

Accepted Solution

raterus earned 2000 total points
ID: 13823699
It looks like you are not setting the SMTPServer to send the email from,

  SmtpMail.SmtpServer = "mail.mydomain.com"
  SmtpMail.Send( _
    "Sending Mail!",_

Author Comment

ID: 13823705
Well I did as You said, It is still giving me an error.So that wasnt the problem.
Thanks for trying. There is something else in there.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 13823921
Can you reference a mail server to do the page?

I changed the code a bit.

Now if I look at it in design mode it tells me the email is sent. So the reason I can not view it in the browser is because I dont have the SmtpMail.SmtpServer?

LVL 33

Expert Comment

ID: 13823945
There is a way to configure the server with a default mail server if you don't set it, I'm not sure how it is done though.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month16 days, 19 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question