Click here to Skip to main content
15,889,116 members
Home / Discussions / Web Development
   

Web Development

 
QuestionCan i use mailto for this? Pin
kingu39921-Jul-20 5:15
kingu39921-Jul-20 5:15 
AnswerRe: Can i use mailto for this? Pin
Afzaal Ahmad Zeeshan1-Sep-20 9:10
professionalAfzaal Ahmad Zeeshan1-Sep-20 9:10 
QuestionHow can I submit with 1 button and 1 form with 2 actions? Pin
amitb220-Jul-20 23:06
amitb220-Jul-20 23:06 
AnswerRe: How can I submit with 1 button and 1 form with 2 actions? Pin
W Balboos, GHB30-Jul-20 7:06
W Balboos, GHB30-Jul-20 7:06 
QuestionAsp.Net Core Web API Pin
Kevin Marois15-Jul-20 11:43
professionalKevin Marois15-Jul-20 11:43 
AnswerRe: Asp.Net Core Web API Pin
Richard Deeming15-Jul-20 23:29
mveRichard Deeming15-Jul-20 23:29 
Questionnot close sqlitedb in php is ok? Pin
Member 144909644-Jul-20 21:05
Member 144909644-Jul-20 21:05 
AnswerRe: not close sqlitedb in php is ok? Pin
Richard MacCutchan4-Jul-20 21:11
mveRichard MacCutchan4-Jul-20 21:11 
GeneralRe: not close sqlitedb in php is ok? Pin
Member 144909644-Jul-20 21:16
Member 144909644-Jul-20 21:16 
GeneralRe: not close sqlitedb in php is ok? Pin
Richard MacCutchan4-Jul-20 21:44
mveRichard MacCutchan4-Jul-20 21:44 
Questionweb development: php, MSQLI Pin
baalfire4-Jul-20 1:16
baalfire4-Jul-20 1:16 
AnswerRe: web development: php, MSQLI Pin
Richard MacCutchan4-Jul-20 3:36
mveRichard MacCutchan4-Jul-20 3:36 
AnswerRe: web development: php, MSQLI Pin
ellegonzalez26-Dec-20 5:45
ellegonzalez26-Dec-20 5:45 
Questionrestore real ip to access.log of xampp apache server registered in cloudflare Pin
Member 144909643-Jul-20 21:12
Member 144909643-Jul-20 21:12 
QuestionMessage Removed Pin
2-Jul-20 8:04
Saim Irfan2-Jul-20 8:04 
Questionwhat would you recommend me to use graphs in PHP+MySQL? Pin
Joan M18-Jun-20 9:49
professionalJoan M18-Jun-20 9:49 
Questionnode js express redirect from http to https Pin
Oscar K.13-Jun-20 1:45
Oscar K.13-Jun-20 1:45 
QuestionPlotting points on interactive map Pin
StampedePress9-Jun-20 5:07
StampedePress9-Jun-20 5:07 
AnswerRe: Plotting points on interactive map Pin
Saim Irfan2-Jul-20 7:58
Saim Irfan2-Jul-20 7:58 
Questionweb development Pin
moustafa arabi6-Jun-20 3:39
moustafa arabi6-Jun-20 3:39 
AnswerRe: web development Pin
Mycroft Holmes6-Jun-20 12:07
professionalMycroft Holmes6-Jun-20 12:07 
QuestionHow to successfully Async download a pdf file to a client PC vb.net web application Pin
Amer Amer5-Jun-20 22:47
Amer Amer5-Jun-20 22:47 
AnswerRe: How to successfully Async download a pdf file to a client PC vb.net web application Pin
F-ES Sitecore6-Jun-20 2:40
professionalF-ES Sitecore6-Jun-20 2:40 
AnswerRe: How to successfully Async download a pdf file to a client PC vb.net web application Pin
Richard Deeming8-Jun-20 0:24
mveRichard Deeming8-Jun-20 0:24 
Amer Amer wrote:
VB.NET
Dim sqlcom As New SqlCommand("select bookcontent,bookname from books where  bookn=" & Page.RouteData.Values("bookn").ToString & "", conn)
Your code is vulnerable to SQL Injection[^]. NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.
VB.NET
Dim ds As New DataTable
Using sqlcom As New SqlCommand("select bookcontent,bookname 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 fff As String = ds.Rows(0).Field(Of String)("bookname")
    Dim fileInfo As FileInfo = New FileInfo(filename)
    If fileInfo.Exists Then
        Response.Clear()
        Response.Cache.SetCacheability(HttpCacheability.NoCache)
        Response.ContentType = "application/pdf"
        Response.AddHeader("Content-Disposition", "inline; filename=""" & fff & ".pdf" & """")
        Response.AddHeader("Content-Length", fileInfo.Length.ToString())
        Response.TransmitFile(filename)
        Response.Flush()
        Context.ApplicationInstance.CompleteRequest()
        Return
    End If
End If
Everything you wanted to know about SQL injection (but were afraid to ask) | Troy Hunt[^]
How can I explain SQL injection without technical jargon? | Information Security Stack Exchange[^]
Query Parameterization Cheat Sheet | OWASP[^]

As already mentioned, this is the only way to send the file to the user. IIS is pretty good at handling file transfers; requests from other users shouldn't be blocked whilst the file is downloading.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: How to successfully Async download a pdf file to a client PC vb.net web application Pin
Amer Amer8-Jun-20 4:11
Amer Amer8-Jun-20 4:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.