开发者

How can I grab the current url and assign it to a variable using vb and asp.net?

I have a form that the user fills out and submits. I have vb code that converts that form into an email and sends it to me. I need to know what page it is coming from so I want to assign the current url to a variable that will be included in the email.

Simply put: How do I ass开发者_StackOverflow中文版ign the URL to a variable?


You can find this in the request object. e.g. Request.Url.AbsoluteUri

Dim url As String = Request.Url.AbsoluteUri


VB.NET 'static variable

Private Shared prevPage As String = String.Empty

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        If (Not IsPostBack) Then
            prevPage = Request.UrlReferrer.ToString()
        End If
End Sub
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜