Monday, March 26, 2012
Please help - Client/Server communication with VB.Net/ASP
another computer for testing.
On the "host" computer I have installed IIS and used VB.Net to create an
HTML member in the c:\ root directory called Index.htm. This module is a
simple "Hello World" HTML file. This machine is connected to the internet
and has a static IP address.
On the "Client" computer I enter the IP address of the host (with or without
"\Index.htm") on the Address line of IE6 and press enter.
I should then see my "Hello World" file, right? Well, I get "This page
cannot be displayed". What am I missing??
Thanks in advance,
JohnHi John,
I think you should put the Index.htm under wwwroot folder. By default, it is
the "c:\inetpub\wwwroot" folder.
--
Regards,
Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
"John Howard" <john_howard@.dcf.state.fl.us> wrote in message
news:3ffea1e2$1@.news.hcs.net...
> I am writing my first VB.Net ASP application and would like to set up
> another computer for testing.
> On the "host" computer I have installed IIS and used VB.Net to create an
> HTML member in the c:\ root directory called Index.htm. This module is a
> simple "Hello World" HTML file. This machine is connected to the internet
> and has a static IP address.
> On the "Client" computer I enter the IP address of the host (with or
without
> "\Index.htm") on the Address line of IE6 and press enter.
> I should then see my "Hello World" file, right? Well, I get "This page
> cannot be displayed". What am I missing??
> Thanks in advance,
> John
Friday, March 16, 2012
please help me understand! ASP.Net - VB.NET
ok, so i took this sample form a site that offered to take the source code for the perpose of learning so i did. except that it is not working on my machine but its running where i got it from (the site).
could you please assist me knowing where the code went wrong?
the code is listed below:
<%@dotnet.itags.org. Page Language="VB" ClientTarget="downlevel" %>
<%@dotnet.itags.org. Import Namespace="System.Web.Mail" %>
<script language="VB" runat="server">
Sub btnSendMail_OnClick(Source As Object, E As EventArgs)
Dim myMessage As New MailMessage
Dim myMail As SmtpMail
Dim strEmail As String
If Page.IsValid() Then
strEmail = txtEmail.Text
myMessage.From = "webmaster@dotnet.itags.org." & Request.ServerVariables("SERVER_NAME")
myMessage.To = strEmail
myMessage.Subject = "E-mail Sample from ASP 101!"
myMessage.Body = "This message was sent from sample code by " & _
"http://www.asp101.com. It is used to show people how " & _
"to send e-mail from an ASP+ page. This mail was sent " & _
"from " & Request.ServerVariables("SERVER_NAME") & ". " & _
vbCrLf & vbCrLf & _
"This email was sent to " & strEmail & "."
' Doesn't have to be local... just enter your
' SMTP server's name or ip address!
myMail.SmtpServer = "localhost"
myMail.Send(myMessage)
frmEmail.Visible = False
lblUserMessage.Text = "Your message has been sent to " & strEmail & "."
End If
End Sub
</script>
<html>
<head>
<title>ASP+ Email Sample</title>
</head>
<body>
<asp:Label id="lblUserMessage" text="Enter your e-mail address:" runat="server" />
<form method="post" id="frmEmail" runat="server">
<asp:TextBox id="txtEmail" size="30" runat="server" />
<asp:RequiredFieldValidator runat="server"
id="validEmailRequired" ControlToValidate="txtEmail"
errormessage="Please enter an email address."
display="Dynamic" />
<asp:RegularExpressionValidator runat="server"
id="validEmailRegExp" ControlToValidate="txtEmail"
ValidationExpression="^[\w-]+@dotnet.itags.org.[\w-]+\.(com|net|org|edu|mil)$"
errormessage="Please enter a valid email address."
Display="Dynamic" />
<asp:Button id="btnSendMail" text="Send Mail!" OnClick="btnSendMail_OnClick" runat="server" />
</form>
</body>
</html>
Thanks,
Rami Wahdan.
Hello,
I'm beginner also, but what I would try is:
Change line:
myMessage.From = "webmaster@." & Request.ServerVariables("SERVER_NAME")
into:
myMessage.From = "your@.email.com"
and delete these lines:
' Doesn't have to be local... just enter your
' SMTP server's name or ip address!
myMail.SmtpServer = "localhost"
Rami,
it would also help if you would paste the exact error you are getting ... that will help in identifying your problem ...
cheers,
erik
ok so the error is:
Server Error in '/ASP.NET/email' Application.
The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for a@.a.com
Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details:System.Runtime.InteropServices.COMException: The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for a@.a.com
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL: |
Stack Trace:
|
Version Information: Microsoft .NET Framework Version:2.0.40607.16; ASP.NET Version:2.0.40607.16
hmm, the error seems rather clear, what exactly did you do to solve it?
>The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for a@.a.com
this means that the address you are sending to (a@.a.com) does not exist ...
to prevent this error to cause this page to display, you could add a Try ... Catch ... End Try statement around myMail.send(myMessage), like this:
Try
myMail.Send(myMessage)
Catch ex as Exception
End Try
Mind you, this only prevents the application to stop on the error, you should add code to handle the error properly
HTH
cheers,
erik