By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,285 Members | 1,691 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,285 IT Pros & Developers. It's quick & easy.

Acccess to a file on desktop is denied

P: n/a
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?
Oct 31 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"vvenk" <vv***@discussions.microsoft.comwrote in message
news:3E**********************************@microsof t.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
Oct 31 '06 #2

P: n/a
Michael:

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

"Michael C" wrote:
"vvenk" <vv***@discussions.microsoft.comwrote in message
news:3E**********************************@microsof t.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
Nov 1 '06 #3

P: n/a
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.

"Michael C" wrote:
"vvenk" <vv***@discussions.microsoft.comwrote in message
news:3E**********************************@microsof t.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
Nov 1 '06 #4

P: n/a
Perhaps this will help:
http://www.microsoft.com/downloads/d...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:
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?
Nov 1 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.