Posted on 2011-02-14
Last Modified: 2012-05-11
I have attached the VB "Behind Code" for a form that when submitted sends data to the data base and
a subsequent e-mail.

Everything works as desired except the "Response Redirect".   It redirect to an unknow page but the e-mail and data
is sent.   Need help working out the "Response Redirect" problem.
Imports System.Net
Imports System.Net.Mail

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs)

        Dim con As New System.Data.OleDb.OleDbConnection

        Dim myPath As String 
        myPath = Server.MapPath("database2.mdb")

        con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data source=" & myPath & ";"
        Dim myCommand As New System.Data.OleDb.OleDbCommand

        myCommand.CommandText = String.Format("INSERT INTO AOS([Dates],[Ship],[ArrTime],[InFlt],[History],[ETRDate],[ETRTime],[Station],[Reason1],[Status1],[Updated],[Reason2],[Parts]) VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}')", DateTime.Parse(Dates.Text), Ship.Text, ArrTime.Text, InFlt.Text, History.Text, DateTime.Parse(ETRDate.Text), ETRTime.Text, Station.Text, Reason1.Text, Status1.Text, Updated.Text, Reason2.Text, Parts.Text)
        myCommand.Connection = con

        'Send Email
        Dim smtpClient As SmtpClient = New SmtpClient()
        Dim message As MailMessage = New MailMessage()
        Dim fromAddress As MailAddress = New MailAddress("") 
        message.From = fromAddress
        message.Subject = "AOS EVENT"

        Dim palinBody As String = "Ship: " & Ship.Text & ""

        Dim plainView As AlternateView = AlternateView.CreateAlternateViewFromString(palinBody, Nothing, "text/plain")
        Dim htmlBody As String = "<p>Ship: " & Ship.Text & ""

        Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString(htmlBody, Nothing, "text/html")
        message.Priority = MailPriority.High
        smtpClient.Host = ""


    End Sub
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

End Class

Open in new window

Question by:BOEING39
LVL 10

Accepted Solution

himanshut earned 250 total points
ID: 34894030
to which page does it redirect?
Other than
LVL 39

Assisted Solution

by:Pratima Pharande
Pratima Pharande earned 250 total points
ID: 34894061

Is this is different site or your own site form where you are calling this

then try

else try


Author Closing Comment

ID: 34894121
Guys thx for the help.   I used the Server Redirect with a different address which worked....

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
More on Time zones in vb 2010 12 37
Not showing JavaScript in the list 5 35
Split in Javascript 5 30
Help with C#, MVC, razor. 6 18
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

939 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now