I need help here guys I'm using visual studio 2015 with VB language Web application, My problem is a little bit weird, I have website for free E-books the user can chose any book after that they can download it Immediately or read it on website page contain object data that show pdf file requested by user. before I use MapPageRoute every thing fine in both desktop or smart phone after using MapPageRoute every thing fine while using desktop download or read except smart phone or tablet when I click read(linkbutton) its not shown pdf file.
code of the page that show requested pdf
Private Sub showpdfbook_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
If (Page.RouteData.Values.ContainsKey("bookn")) Then
Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("sraajconn").ConnectionString)
Dim ds As New DataTable
Using sqlcom As New SqlCommand("select bookcontent from books where bookn = @bookn", conn)
sqlcom.Parameters.AddWithValue("@bookn", Page.RouteData.Values("bookn"))
Dim da As New SqlDataAdapter(sqlcom)
da.Fill(ds)
End Using
If ds.Rows.Count <> 0 Then
Dim filename As String = ds.Rows(0).Field(Of String)("bookcontent")
Dim embed As String = "<object data=""{0}"" type=""application/pdf"" width=""790px"" height=""690"">"
embed += "لايمكن عرض الملف لايوجد لديك برنامج التشغيل(PDF) , تستطيع تحميل البرنامج <a href = ""{0}"">اضغط هنا</a>"
embed += " or download <a target = ""_blank"" href = ""http://get.adobe.com/reader/"">Adobe PDF Reader</a> to view the file."
embed += "</object>"
pdfdisplay.Text = String.Format(embed, ResolveUrl("~" & filename.ToString.Substring(33)))
End If
Else
Response.Redirect("home")
End If
Catch ex As Exception
ExceptionLogging.SendErrorToText(ex)
End Try
End Sub
code of the linkbutton
Protected Sub LinkBread_Click(sender As Object, e As EventArgs)
Try
Dim getname As Label = CType((FormView1.FindControl("Label3")), Label)
Response.RedirectToRoute("RouteForshowpdfbooks", New With {Key .bookn = Page.RouteData.Values("bookn").ToString(), Key .bookname = Getbookname(getname.Text)})
Catch ex As Exception
ExceptionLogging.SendErrorToText(ex)
End Try
End Sub
Protected Function Getbookname(ByVal obj As Object) As String
Return obj.ToString().Replace(" "c, "-"c)
End Function
this what I have in Global.asax
Public Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.MapPageRoute("RouteForViewbook", "View-book/{bookn}/{bookname}", "~/ViewbookA.aspx")
routes.MapPageRoute("RouteForshowpdfbooks", "read/{bookn}/{bookname}", "~/showpdfbook.aspx")
routes.MapPageRoute("RouteForsearchbooks", "search-value/{value}", "~/searchbooks.aspx")
routes.MapPageRoute("RouteForbooksearchcategoriesandauthors", "search-{pagename}/{value}", "~/booksearch.aspx")
End Sub
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
RegisterRoutes(RouteTable.Routes)
End Sub
Thank you in advance.
What I have tried:
I try a lot of step but I didn't succeed