Click here to Skip to main content
16,004,927 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questiondropdownlistbox Pin
aratireddy12-Feb-09 23:44
aratireddy12-Feb-09 23:44 
AnswerRe: dropdownlistbox Pin
Satish Mahapatra12-Feb-09 23:49
Satish Mahapatra12-Feb-09 23:49 
AnswerRe: dropdownlistbox Pin
raju melveetilpurayil15-Feb-09 8:14
professionalraju melveetilpurayil15-Feb-09 8:14 
QuestionActiveX for Thermal Printer not working Pin
bugsb4u12-Feb-09 23:12
bugsb4u12-Feb-09 23:12 
QuestionCan't create Reporting Services Project Pin
grewin12-Feb-09 22:27
grewin12-Feb-09 22:27 
AnswerRe: Can't create Reporting Services Project Pin
rakeshs31212-Feb-09 22:52
rakeshs31212-Feb-09 22:52 
GeneralRe: Can't create Reporting Services Project Pin
grewin12-Feb-09 23:13
grewin12-Feb-09 23:13 
QuestionError in listing a directory's content on web Pin
vikram00112-Feb-09 21:15
vikram00112-Feb-09 21:15 
Hi,
I am trying to list the files stored in a directory on my web server, i want the visitor to be able to download these files. Following is the code.

]]>



Sub Page_Load(sender As Object, e As EventArgs)

Dim root As String = "files/"

Dim files() As String = Directory.GetFiles(root)
Dim sb As New StringBuilder(2048)
Dim f As String
For Each f In files
Dim filename As String = Path.GetFileName(f)
sb.Append("<br><a href="FileDownload?file=")&lt;br" mode="hold" /> sb.Append(root).Append(Server.UrlEncode(filename))
sb.Append("&gt;").Append(filename).Append("")
Next
fileList.Text = sb.ToString()

End Sub

</br>




<asp:label id="fileList" runat="server" xmlns:asp="#unknown">




and following is the filedownload.aspx (mentined as filedownload above) page

]]>
]]>

Sub Page_Load(sender As Object, e As EventArgs)

Dim root As String = "files/"
Dim filepath As String = Request.Params("file")
If Not filepath Is Nothing Then
If File.Exists(filepath) And filepath.StartsWith(root) Then
Dim filename As String = Path.GetFileName(filepath)
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", _
"attachment; filename=""" & filename & """")
Response.Flush()
Response.WriteFile(filepath)
End If
End If

End Sub






<title>Untitled Document





this code is working file on my localhost. but is giving a prob on web as:

Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customerrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customerrors> tag should then have its "mode" attribute set to "Off".

can anyone help me regarding this???
AnswerRe: Error in listing a directory's content on web Pin
Christian Graus12-Feb-09 21:27
protectorChristian Graus12-Feb-09 21:27 
Questioneditor Pin
anujbanka178412-Feb-09 21:11
anujbanka178412-Feb-09 21:11 
AnswerRe: editor Pin
Christian Graus12-Feb-09 21:25
protectorChristian Graus12-Feb-09 21:25 
GeneralRe: editor Pin
anujbanka178412-Feb-09 22:28
anujbanka178412-Feb-09 22:28 
QuestionEditing on PDF [modified] Pin
NidhiKanu12-Feb-09 20:26
professionalNidhiKanu12-Feb-09 20:26 
AnswerRe: Editing on PDF Pin
Vimalsoft(Pty) Ltd12-Feb-09 20:37
professionalVimalsoft(Pty) Ltd12-Feb-09 20:37 
AnswerRe: Editing on PDF Pin
Christian Graus12-Feb-09 20:37
protectorChristian Graus12-Feb-09 20:37 
QuestionGetting path from a datagrid link button [modified] Pin
rakeshs31212-Feb-09 20:15
rakeshs31212-Feb-09 20:15 
AnswerRe: Getting path from a datagrid link button Pin
Satish Mahapatra12-Feb-09 21:00
Satish Mahapatra12-Feb-09 21:00 
QuestionValidator's across Content Place Holders Pin
mombawomba12-Feb-09 20:10
mombawomba12-Feb-09 20:10 
QuestionUPLOAD IMAGE Pin
JAYRAJ GIRI12-Feb-09 19:37
JAYRAJ GIRI12-Feb-09 19:37 
AnswerRe: UPLOAD IMAGE Pin
VijayVishwakarma12-Feb-09 20:07
VijayVishwakarma12-Feb-09 20:07 
QuestionEncrypt data from database Pin
Guvera12-Feb-09 19:23
Guvera12-Feb-09 19:23 
AnswerRe: Encrypt data from database Pin
ABitSmart12-Feb-09 20:47
ABitSmart12-Feb-09 20:47 
GeneralRe: Encrypt data from database Pin
Guvera12-Feb-09 21:20
Guvera12-Feb-09 21:20 
GeneralRe: Encrypt data from database Pin
ABitSmart12-Feb-09 21:29
ABitSmart12-Feb-09 21:29 
QuestionTree view control Pin
anandhakrishnan12-Feb-09 19:04
anandhakrishnan12-Feb-09 19:04 

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.