I'm using asp.net/VB.net in my app.
I have a button which onclick I redirect to another page:
Response.Redirect("/MyPage.aspx?userName=myUser")
and this page has a handler, so in ProcessRequest I use the following method to read userName:
Public Sub ProcessRequest(context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim lUserName As String = Mid(context.Request.UrlReferrer.ToString, context.Request.UrlReferrer.ToString.LastIndexOf("userName=") + Len("userName=") + 1)
End Sub
But I had to use POST method instead of GET, so I changed the way of redirect to:
Dim sb = New StringBuilder()
Dim sb = New StringBuilder()
sb.Append("<html>")
sb.AppendFormat("<body önload='document.forms[""form""].submit()'>")
sb.AppendFormat("<form name='form' action='{0}' method='post'>", "/MyPage.aspx")
sb.AppendFormat("<input type='hidden' name='userName' value='{0}'>", "myUser")
sb.Append("</form>")
sb.Append("</body>")
sb.Append("</html>")
Response.Write(sb.ToString())
Response.End()
Response.Write(sb.ToString())
Response.End()
How to read the param (userName) now in handler class?? since I can't use the UrlReferrer anymore.