I am able to redirect to the previous page once someone presses the button by using the following code...but I can't get the url if on a secure page, behind SSL, or if the page is bookmarked, I get an error. Is there a better way to capture the previous page
the user was on and considering the non standard scenarios of being behind SSL or directly linked to from a non site page or bookmark?
If (Not IsPostBack) Then
prevPage = Request.UrlReferrer.ToString()
End If
Here is what I have so far... it's getting the continue button to click that i am having the issue with once the email is sent....line 19 is where it would need to fire
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (Not IsPostBack) Then
btnContinue.Attributes.Add("onClick", "javascript:history.back(); return false;")
End If
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim emailnotice As New Mail.MailMessage
emailnotice.BodyEncoding = New System.Text.UTF8Encoding
emailnotice.BodyFormat = Mail.MailFormat.Html
emailnotice.From = ConfigurationSettings.AppSettings("email")
emailnotice.To = ConfigurationSettings.AppSettings("email")
emailnotice.Subject = "Feedback"
emailnotice.Body = txtFeedBack.Text
Mail.SmtpMail.SmtpServer = ConfigurationSettings.AppSettings("remote")
Dim mailSent As Boolean
Mail.SmtpMail.Send(emailnotice)
'Click Continue button here
End Sub
Here is what I have so far... it's getting the continue button to click that i am having the issue with once the email is sent....line 19 is where it would need to fire
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (Not IsPostBack) Then
btnContinue.Attributes.Add("onClick", "javascript:history.back(); return false;")
End If
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim emailnotice As New Mail.MailMessage
emailnotice.BodyEncoding = New System.Text.UTF8Encoding
emailnotice.BodyFormat = Mail.MailFormat.Html
emailnotice.From = ConfigurationSettings.AppSettings("email")
emailnotice.To = ConfigurationSettings.AppSettings("email")
emailnotice.Subject = "Feedback"
emailnotice.Body = txtFeedBack.Text
Mail.SmtpMail.SmtpServer = ConfigurationSettings.AppSettings("remote")
Dim mailSent As Boolean
Mail.SmtpMail.Send(emailnotice)
'Click Continue button here
End Sub
Once your questions have been answered, remember to mark the question as answered, this rewards the people helping you and helps others to move on to the next unanswered question.
Marked as answer by goliathwilson on Jan 17, 2008 06:42 PM
goliathwilso...
Member
4 Points
16 Posts
redirect to previous page
Jan 16, 2008 10:31 PM|LINK
roni_schuetz
Member
614 Points
163 Posts
Re: redirect to previous page
Jan 17, 2008 12:45 AM|LINK
why not to do that on client side? history.back() per javascript?
---
speed up your applications with distributed caching or replicated caching: http://www.sharedcache.com - its free!
pinakin2in
Member
653 Points
151 Posts
Re: redirect to previous page
Jan 17, 2008 04:29 AM|LINK
<input name="btnBack" title="Previous Page"
onMouseOver="window.status='Previous Page'; return true"
onMouseOut="window.status=''; return true"
onclick="location.href = 'javascript:history.go(-1)'" ; type="button"
value="Previous Page">
Pinakin Patel
vinz
All-Star
126936 Points
17922 Posts
MVP
Re: redirect to previous page
Jan 17, 2008 06:23 AM|LINK
Try this
if (Request.UrlReferrer != null)
{
Response.Write(Request.UrlReferrer.ToString());
}
MessageBox Controls for WebForms | Blog | Twitter | Linkedin
usmanbhatti5...
Member
562 Points
117 Posts
Re: redirect to previous page
Jan 17, 2008 06:34 AM|LINK
i think this will help u
ScriptManager.RegisterStartupScript(this, typeof(System.String), "startScript", "<script language='javascript'>{alert('Your RFQ # " + txtRfqNo.Text + " has been successfully saved');window.location = 'MyRFQ.aspx?RFQNo=" + HttpUtility.UrlEncode(txtRfqNo.Text) + "';}</script>", false);
Please remember to click "Mark as Answer" on this post if it helped you.
www.usman-bhatti.blogspot.com
goliathwilso...
Member
4 Points
16 Posts
Re: redirect to previous page
Jan 17, 2008 05:15 PM|LINK
Here is what I have so far... it's getting the continue button to click that i am having the issue with once the email is sent....line 19 is where it would need to fire
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If (Not IsPostBack) Then btnContinue.Attributes.Add("onClick", "javascript:history.back(); return false;") End If End Sub Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click Dim emailnotice As New Mail.MailMessage emailnotice.BodyEncoding = New System.Text.UTF8Encoding emailnotice.BodyFormat = Mail.MailFormat.Html emailnotice.From = ConfigurationSettings.AppSettings("email") emailnotice.To = ConfigurationSettings.AppSettings("email") emailnotice.Subject = "Feedback" emailnotice.Body = txtFeedBack.Text Mail.SmtpMail.SmtpServer = ConfigurationSettings.AppSettings("remote") Dim mailSent As Boolean Mail.SmtpMail.Send(emailnotice) 'Click Continue button here End Subshadowraider...
Member
353 Points
143 Posts
Re: redirect to previous page
Jan 17, 2008 06:09 PM|LINK
try using this: <
a href="javascript:history.go(-1)"> [Go to Previous Page]</a>Regards
Nick Kusters
Participant
1376 Points
245 Posts
Re: redirect to previous page
Jan 17, 2008 06:15 PM|LINK
Already awnsered in http://forums.asp.net/t/1206645.aspx
Once your questions have been answered, remember to mark the question as answered, this rewards the people helping you and helps others to move on to the next unanswered question.