Home All Groups Group Topic Archive Search About

Acccess to a file on desktop is denied

Author
31 Oct 2006 10:52 PM
vvenk
Hello:

I have an ASP application that takes a file and parses it.
I have a fileUpload control on my ASP page. Here's the code that gets file
details:

        Dim srFile As StreamReader

        Try
            srFile = New StreamReader(getFile.PostedFile.FileName)
        Catch ex As Exception
            Err.Raise(_iErrorbase + 0, "ProcessFile", ex.Message)
            Return False
        End Try

When I am prompted and I choose a file anywhere but my desktop, the code
does not raise an exception. But if I choose a file that is on my Desktop, it
says "Access to ... is denied".

And, it does not happen on my development box but it happens on the
prooduction box.

Can somebody shed light on this issue?

Author
31 Oct 2006 11:34 PM
Michael C
Show quote Hide quote
"vvenk" <vv***@discussions.microsoft.com> wrote in message
news:3E3C2F67-0E60-43BC-89A7-025D43402CFE@microsoft.com...
> Hello:
>
> I have an ASP application that takes a file and parses it.
> I have a fileUpload control on my ASP page. Here's the code that gets file
> details:
>
>        Dim srFile As StreamReader
>
>        Try
>            srFile = New StreamReader(getFile.PostedFile.FileName)
>        Catch ex As Exception
>            Err.Raise(_iErrorbase + 0, "ProcessFile", ex.Message)
>            Return False
>        End Try
>
> When I am prompted and I choose a file anywhere but my desktop, the code
> does not raise an exception. But if I choose a file that is on my Desktop,
> it
> says "Access to ... is denied".

I don't use asp much but is getFile.PostedFile.FileName the file on the
user's machine? If that's the case then it will be working only because the
server and client are the same machine, if this was a real web situation it
would not work. The reason it fails for desktop is that the asp user doesn't
have access to your desktop.

Michael
Author
31 Oct 2006 11:47 PM
vvenk
Michael:

How would I then access a file that's on the user's desktop?

Show quoteHide quote
"Michael C" wrote:

> "vvenk" <vv***@discussions.microsoft.com> wrote in message
> news:3E3C2F67-0E60-43BC-89A7-025D43402CFE@microsoft.com...
> > Hello:
> >
> > I have an ASP application that takes a file and parses it.
> > I have a fileUpload control on my ASP page. Here's the code that gets file
> > details:
> >
> >        Dim srFile As StreamReader
> >
> >        Try
> >            srFile = New StreamReader(getFile.PostedFile.FileName)
> >        Catch ex As Exception
> >            Err.Raise(_iErrorbase + 0, "ProcessFile", ex.Message)
> >            Return False
> >        End Try
> >
> > When I am prompted and I choose a file anywhere but my desktop, the code
> > does not raise an exception. But if I choose a file that is on my Desktop,
> > it
> > says "Access to ... is denied".
>
> I don't use asp much but is getFile.PostedFile.FileName the file on the
> user's machine? If that's the case then it will be working only because the
> server and client are the same machine, if this was a real web situation it
> would not work. The reason it fails for desktop is that the asp user doesn't
> have access to your desktop.
>
> Michael
>
>
>
Author
1 Nov 2006 2:27 PM
vvenk
Michael:

But if I choose a file anywhere else on the user's machine (c:\, anything),
it works fine.

The problem is only when I select something on the user's desktop.

Show quoteHide quote
"Michael C" wrote:

> "vvenk" <vv***@discussions.microsoft.com> wrote in message
> news:3E3C2F67-0E60-43BC-89A7-025D43402CFE@microsoft.com...
> > Hello:
> >
> > I have an ASP application that takes a file and parses it.
> > I have a fileUpload control on my ASP page. Here's the code that gets file
> > details:
> >
> >        Dim srFile As StreamReader
> >
> >        Try
> >            srFile = New StreamReader(getFile.PostedFile.FileName)
> >        Catch ex As Exception
> >            Err.Raise(_iErrorbase + 0, "ProcessFile", ex.Message)
> >            Return False
> >        End Try
> >
> > When I am prompted and I choose a file anywhere but my desktop, the code
> > does not raise an exception. But if I choose a file that is on my Desktop,
> > it
> > says "Access to ... is denied".
>
> I don't use asp much but is getFile.PostedFile.FileName the file on the
> user's machine? If that's the case then it will be working only because the
> server and client are the same machine, if this was a real web situation it
> would not work. The reason it fails for desktop is that the asp user doesn't
> have access to your desktop.
>
> Michael
>
>
>
Author
1 Nov 2006 2:44 PM
ImageAnalyst
Perhaps this will help:
http://www.microsoft.com/downloads/details.aspx?FamilyID=df59b474-c0b7-4422-8c70-b0d9d3d2f575&DisplayLang=en

Brief Description
This application compatibility tool helps developers and IT
professionals diagnose issues that would prevent a program from running
properly as a standard user.

Introduction

The "Standard User Analyzer" (previously known as the "LUA
Analyzer") is a tool to help independent software vendors (ISVs), IT
professionals, and end users diagnose possible issues in an application
when it is running as a standard user. The Standard User Analyzer is
based upon the "LUA Predictor" technology, which is part of the
Microsoft Application Verifier.

Installation Prerequisites and Compatibility

Operating systems: Windows Vista, Windows XP, and Windows Server 2003.

Note: Currently, only a 32-bit version of the Standard User Analyzer is
available.

Installation prerequisites: The Application Verifier must be installed
before the Standard User Analyzer installation is launched. The
Application Verifier is a free download on the Microsoft Web site.

But maybe not.  I installed it and it gives a lot of information but
I'm not sure what to do with it all.  It doesn't give you step by step
instructions on how to fix a line of your code.  It's pretty cryptic -
to me at least.
Regards,
ImageAnalyst


vvenk wrote:
Show quoteHide quote
> Hello:
>
> I have an ASP application that takes a file and parses it.
> I have a fileUpload control on my ASP page. Here's the code that gets file
> details:
>
>         Dim srFile As StreamReader
>
>         Try
>             srFile = New StreamReader(getFile.PostedFile.FileName)
>         Catch ex As Exception
>             Err.Raise(_iErrorbase + 0, "ProcessFile", ex.Message)
>             Return False
>         End Try
>
> When I am prompted and I choose a file anywhere but my desktop, the code
> does not raise an exception. But if I choose a file that is on my Desktop, it
> says "Access to ... is denied".
>
> And, it does not happen on my development box but it happens on the
> prooduction box.
>
> Can somebody shed light on this issue?