Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
List files from directory
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  13 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
nag  
View profile  
 More options Jul 1, 9:41 am
From: nag <nagesh...@gmail.com>
Date: Wed, 1 Jul 2009 06:41:43 -0700 (PDT)
Local: Wed, Jul 1 2009 9:41 am
Subject: List files from directory
hii
im listing files from directory..here is my code
i feel its nt a secure code
Is anyone knw secure code please let me knw

 void Page_Load(object sender, EventArgs e)
    {
        string dirname = Session["projectid"].ToString();

        string Path = Server.MapPath(".") + "\\" + dirname;

        DirectoryInfo dirInfo = new DirectoryInfo(Path);

        articleList.DataSource = dirInfo.GetFiles("*.*");
        articleList.DataBind();
    }

<asp:DataGrid runat="server" id="articleList" Font-Name="Verdana"
    AutoGenerateColumns="False" AlternatingItemStyle-
BackColor="#eeeeee"
    HeaderStyle-BackColor="Navy" HeaderStyle-ForeColor="White"
    HeaderStyle-Font-Size="15pt" HeaderStyle-Font-Bold="True">
  <Columns>
    <asp:HyperLinkColumn DataNavigateUrlField="Name"
DataTextField="Name"
           HeaderText="File Name" />
    <asp:BoundColumn DataField="LastWriteTime" HeaderText="Last Write
Time"
        ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />
    <asp:BoundColumn DataField="Length" HeaderText="File Size"
                ItemStyle-HorizontalAlign="Right"
                DataFormatString="{0:#,### bytes}" />
  </Columns>
</asp:DataGrid>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brandon Betances  
View profile  
 More options Jul 1, 9:58 am
From: Brandon Betances <bbetan...@gmail.com>
Date: Wed, 1 Jul 2009 09:58:14 -0400
Local: Wed, Jul 1 2009 9:58 am
Subject: Re: [DotNetDevelopment] List files from directory

Looks fine to me.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Processor Devil  
View profile  
 More options Jul 1, 11:14 am
From: Processor Devil <processor.de...@gmail.com>
Date: Wed, 1 Jul 2009 17:14:47 +0200
Local: Wed, Jul 1 2009 11:14 am
Subject: Re: [DotNetDevelopment] List files from directory

ok, I will try to solve it :)
So There is the nice Server method Server.MapPath, which give you current
working directory. So path is then current_dir\dirname
Are you scared that someone can use it to get out of server directory and
list your local folders?
Well, ok, Directory Travelsal (that is the name of the exploit), is really
very well known and I don't think that .NET would allow you to do this. If
you don't trust me, just try it yourself or instead of MapPath use your
constant.

2009/7/1 nag <nagesh...@gmail.com>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Processor Devil  
View profile  
 More options Jul 1, 9:58 am
From: Processor Devil <processor.de...@gmail.com>
Date: Wed, 1 Jul 2009 15:58:33 +0200
Local: Wed, Jul 1 2009 9:58 am
Subject: Re: [DotNetDevelopment] List files from directory

well, and why do you think it is unsecure code?

2009/7/1 nag <nagesh...@gmail.com>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cerebrus  
View profile  
 More options Jul 1, 12:04 pm
From: Cerebrus <zorg...@sify.com>
Date: Wed, 1 Jul 2009 09:04:45 -0700 (PDT)
Local: Wed, Jul 1 2009 12:04 pm
Subject: Re: List files from directory
As others have said, first tell us what about the code you believe is
not secure. Or is it just *you* that's being insecure ?

On Jul 1, 6:41 pm, nag <nagesh...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cerebrus  
View profile  
 More options Jul 1, 12:15 pm
From: Cerebrus <zorg...@sify.com>
Date: Wed, 1 Jul 2009 09:15:06 -0700 (PDT)
Local: Wed, Jul 1 2009 12:15 pm
Subject: Re: List files from directory
Directory Traversal... also known as the Canonicalization attack. Very
good! ;-)

On Jul 1, 8:14 pm, Processor Devil <processor.de...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
nag  
View profile  
 More options Jul 2, 12:49 am
From: nag <nagesh...@gmail.com>
Date: Wed, 1 Jul 2009 21:49:59 -0700 (PDT)
Local: Thurs, Jul 2 2009 12:49 am
Subject: Re: List files from directory
the files which i listed in grid is as  downlink ..that link wil be
available on addressbar
is it possible to mask that path?????????????

On Jul 1, 9:04 pm, Cerebrus <zorg...@sify.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
nag  
View profile  
 More options Jul 2, 12:50 am
From: nag <nagesh...@gmail.com>
Date: Wed, 1 Jul 2009 21:50:16 -0700 (PDT)
Local: Thurs, Jul 2 2009 12:50 am
Subject: Re: List files from directory
the files which i listed in grid is as  downlink ..that link wil be
available on addressbar
is it possible to mask that path?????????????

On Jul 1, 6:58 pm, Brandon Betances <bbetan...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Processor Devil  
View profile  
 More options Jul 2, 2:59 am
From: Processor Devil <processor.de...@gmail.com>
Date: Thu, 2 Jul 2009 08:59:06 +0200
Local: Thurs, Jul 2 2009 2:59 am
Subject: Re: [DotNetDevelopment] Re: List files from directory

I see you know a lot :)

2009/7/1 Cerebrus <zorg...@sify.com>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
nag  
View profile  
 More options Jul 3, 4:28 am
From: nag <nagesh...@gmail.com>
Date: Fri, 3 Jul 2009 01:28:53 -0700 (PDT)
Local: Fri, Jul 3 2009 4:28 am
Subject: Re: List files from directory
ahahha hmmm...nice jke.. ( :

On Jul 2, 11:59 am, Processor Devil <processor.de...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Processor Devil  
View profile  
 More options Jul 3, 4:35 am
From: Processor Devil <processor.de...@gmail.com>
Date: Fri, 3 Jul 2009 10:35:25 +0200
Local: Fri, Jul 3 2009 4:35 am
Subject: Re: [DotNetDevelopment] Re: List files from directory

ok, so why do you think it is unsecure? :P

2009/7/3 nag <nagesh...@gmail.com>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
nag  
View profile  
 More options Jul 4, 1:11 am
From: nag <nagesh...@gmail.com>
Date: Fri, 3 Jul 2009 22:11:50 -0700 (PDT)
Local: Sat, Jul 4 2009 1:11 am
Subject: Re: List files from directory
here in my following code im listing files from dynamically created
folder (folder name is userid of the user)
i can get all files in grid...
bt im nt getting virtual path of file
in grid im getting link like this
http://www.site.com/pcs/admin/testt.doc
but actaul file path is
http://www.site.com/pcs/admin/1/testt.doc

void Page_Load(object sender, EventArgs e)
    {
        string dirname = Session["projectid"].ToString();

        string Path = Server.MapPath(".") + "\\" + dirname;

        DirectoryInfo dirInfo = new DirectoryInfo(Path);

        articleList.DataSource = dirInfo.GetFiles("*.*");
        articleList.DataBind();
    }

<asp:DataGrid runat="server" id="articleList" Font-Name="Verdana"
    AutoGenerateColumns="False" AlternatingItemStyle-
BackColor="#eeeeee"
    HeaderStyle-BackColor="Navy" HeaderStyle-ForeColor="White"
    HeaderStyle-Font-Size="15pt" HeaderStyle-Font-Bold="True">
  <Columns>
    <asp:HyperLinkColumn DataNavigateUrlField="Name"
DataTextField="Name"
           HeaderText="File Name" />
    <asp:BoundColumn DataField="LastWriteTime" HeaderText="Last Write
Time"
        ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" /


    <asp:BoundColumn DataField="Length" HeaderText="File Size"
                ItemStyle-HorizontalAlign="Right"
                DataFormatString="{0:#,### bytes}" />
  </Columns>
</asp:DataGrid>

On Jul 3, 1:35 pm, Processor Devil <processor.de...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cerebrus  
View profile  
 More options Jul 4, 2:24 am
From: Cerebrus <zorg...@sify.com>
Date: Fri, 3 Jul 2009 23:24:43 -0700 (PDT)
Local: Sat, Jul 4 2009 2:24 am
Subject: Re: List files from directory
Well, a simple way would be to simply provide a LinkButton that says
"Download file" (or whatever) and invokes a Command on the server. In
this eventhandler, you can query the Command parameters and force a
file to be sent in the response. This way, your actual file location
is never revealed to the user.

Another way would be to create an HttpHandler that intercepts requests
for .doc files and allows the URL to be changed to the actual file
location.

On Jul 4, 10:11 am, nag <nagesh...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google