1

I am using vb.net.

I have an url which is http://localhost:56945/w3school/LeaveApplication.aspx?name=LM#20168226&isApprove=yes

Here i am getting the value of 'name' by Request.QueryString but i am getting only the value 'LM'.

I am not getting the full value 'LM#20168226'

My Code is bellow

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not IsPostBack Then
        Dim c As String = Request.QueryString("name")

        Dim b As String = Request.QueryString("isApprove")
     End If

    End Sub

I have used HttpContext.Current.Request.QueryString("name") but same result.

And server.urldecode same result.

How could i get the full value ??

And thanks in advance.

Joy Acharya
  • 680
  • 1
  • 10
  • 18
  • 3
    The `#` symbol is a [Fragment Identifier](https://www.w3.org/DesignIssues/Fragment.html). Its used by browsers to identify a section in page. Anything following the `#` is never sent to the server. –  Oct 27 '16 at 06:22
  • so is the problem is not solvable by this process ?? If not how can i fix it? any idea please . @StephenMuecke – Joy Acharya Oct 27 '16 at 06:26
  • 1
    If that is hard-coded link, you should replace **#** with **%23**. If that is generated by code, you may want to have a look on [HtmlEncode](https://msdn.microsoft.com/library/w3te6wfz(v=vs.110).aspx) method – Prisoner Oct 27 '16 at 06:30
  • 1
    You can escape it (replace the `#` with `%23`) –  Oct 27 '16 at 06:31
  • If i replace # with %23 then when i will use Request.QueryString("name"), am i able to get the full value like LM#23456 ?? @Alex – Joy Acharya Oct 27 '16 at 06:35
  • You would need to replace it back again –  Oct 27 '16 at 06:57
  • Only way is using javascript. I had almost same situation before. Check this answer. http://stackoverflow.com/questions/10273423/how-to-get-label-value-which-loads-with-javascript – Kadir Oct 27 '16 at 07:02
  • 1
    hey guys i have solved it by only replacing # by %23. I don't need to replace it back again. Just i catch it by request.querystring. Thanks to stephen,alex,kadir – Joy Acharya Oct 27 '16 at 07:09

0 Answers0