I want to retrieve only file.database from the query string in the URL
My code is below
Dim FinalAbsoluteURL As String Dim Parseme as string
Dim MyUrl As String = Request.Url.AbsoluteUri
Dim uri As New Uri(MyUrl)
Dim Something As String = Path.GetFileName(uri.LocalPath)
Dim Spliting As String() = MyUrl.Split("\"c)
Dim lengths As Integer = Spliting.Length
If lengths > 1 Then
FinalAbsoluteURL = Request.Url.Fragment
ElseIf lengths < 2 Then
FinalAbsoluteURL = Request.Url.Query
Wildoo
Member
587 Points
760 Posts
URL Query String parsing
Nov 09, 2012 05:27 PM|LINK
My URL is the following
http://localhost:62098/MyWebsite/ViewTraining.aspx?file.pdf
I want to retrieve only file.database from the query string in the URL
My code is below
Dim FinalAbsoluteURL As String
Dim Parseme as string
Dim MyUrl As String = Request.Url.AbsoluteUri
Dim uri As New Uri(MyUrl)
Dim Something As String = Path.GetFileName(uri.LocalPath)
Dim Spliting As String() = MyUrl.Split("\"c)
Dim lengths As Integer = Spliting.Length
If lengths > 1 Then
FinalAbsoluteURL = Request.Url.Fragment
ElseIf lengths < 2 Then
FinalAbsoluteURL = Request.Url.Query
End If
I want to insert value in Parseme = file.PDF
Please help me
paindaasp
Star
12252 Points
2070 Posts
Re: URL Query String parsing
Nov 09, 2012 05:58 PM|LINK
Try this: http://localhost:62098/MyWebsite/ViewTraining.aspx?f=file.pdf
and in your code:
dim fn as string = Request.QueryString("f")
Wildoo
Member
587 Points
760 Posts
Re: URL Query String parsing
Nov 09, 2012 06:19 PM|LINK
You are the man..thanks alot
Wildoo
Member
587 Points
760 Posts
Re: URL Query String parsing
Nov 09, 2012 07:21 PM|LINK
Would you please have a ook on my other post cause it is related
I am getting error if file doesn t exists I need to redirect to PageNotFound.ASP or custom page
http://forums.asp.net/t/1857679.aspx/1?Try+Catch+Not+working