path related

A

abcd

I have following code

if (!System.IO.File.Exists(sFile))
{

//do something
}
else
{

//do something else

}



my possible sFile values are

\\msnt102\shared\dbs\db1.mdb"
x:\dbs\db1.mdb (where x is a mapped drive to \\msnt102)

above code doesn not work for mapped drives....any workaround....
 
S

Siva M

Possibly because of this?

<msdn>
If the caller does not have sufficient permissions to read the specified
file, no exception is thrown and the method returns false regardless of the
existence of path.
</msdn>

I have following code

if (!System.IO.File.Exists(sFile))
{

//do something
}
else
{

//do something else

}



my possible sFile values are

\\msnt102\shared\dbs\db1.mdb"
x:\dbs\db1.mdb (where x is a mapped drive to \\msnt102)

above code doesn not work for mapped drives....any workaround....
 
G

Grant Merwitz

I believe your ASPNET account does not have the rights to access your mapped
drive.

As a test, try use impersonation to overcome this, impersonating and
Administrator/Power Users account.
 
A

abcd

I am confused with ASPNET user on other machine

Machine A - IIS , ASP.net application hernce has MachineA\ASPNET user
MachineB - non IIS, no aspnet user, no dot net

I have maped a drive \\MachineB\shared on MachineA called as X drive

if I see X drive's security tab properties then I can add only users from
MAchineB and no ASPNET user is available there how can I addd
MachineA\ASPNET user on that drive....
 
G

Grant Merwitz

i don't think you can, as that user is specific to that machine.

But you can either impersonate a common user, or set IIS to be run by a
domain user that can exist on both machines

In IIS, right click on your default website or vistual directory
Click Directory Security
Click Edit

There you can set another user with approprate rights over both machines
 
A

abcd

Thanks Grant now that makes sense.

Are there any security risks if I run my web application as an domina user
as an annonymous user.

thanks
 
G

Grant Merwitz

Good question, but one for which i don't have an answer.
I just know it works :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top