ASP Error : Could not find a part of the path

G

Gianfranco

Hi everybody,

First of all, sorry for my english if it isn't perfect ;-p

I have an error in an asp.net application.

I have win2003 server, with iis 6. I'm developping with visual studio
2005, vb.net, framework 2

I'm trying to access some binary files stored in C: in server2003. if i
access them with C:\... it's fine. Now to access them quickly I work
with a Ramdisk (Y:) and it works fine if i access with Y:\....

If I make a shared folder and try to access them with
\\srv2003\sharedfolder\... it works fine too. But now I'm trying to
access them with a Network Drive Map (Z:) and I get this error :

System.IO.DirectoryNotFoundException: Could not find a part of the path
'Z:\filename.ext'.
at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32
bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String
msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share)
at Service.GetPersonObject(Int32 IdPerso) in
C:\Inetpub\wwwroot\WebServicePerson\WebServicePerson\App_Code\Service.vb:line
1152

I've seen many topics here where it says to give rights to Asp user.
I've made it. Somebody says to make impersonate application and I have
made it too

<identity impersonate="true" userName="user" password="pwd"/>

But i'm still having this problem. Could someone help me?

In fact i'm trying to access these files through a map drive to test
access with webservices throug the network layer. If we make it only
with a shared folder, does windows use the same implementation of
network layer?

I'm waiting some help impatiently ;-)

Gianfranco
 
G

Guest

With windows Server 2003, you need to give access to Network Service. Be wary
of opening up security too much.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
G

Gianfranco

Hi,

thanks you for this answer. I'm not very good with Server 2003. I have
tried to change some security but there is always the same error. Could
someone tell me which security policy to change?

thank you
 
O

Oliver Flint

"You need to give access to Network Services".

Can you elaborate a bit more on this???

Cheers

Ollie
 
J

Juan T. Llibre

"YourMachineName\Network Service" is the account
which ASP.NET runs as in Windows Server 2003.

Give the necessary file access permissions to that account,
that it can access your Z: drive.
..
 
O

Oliver Flint

Could you please elaborate a bit more on this or supply a link???

Cheers

Ollie
 
G

Gianfranco

Hi

I've added this account and given to it "full control" access but it
always don't work correct.

any idea?

P.S. Oliver, what will you that I elaborate more?
 
O

oliverflint

Juan,

Why must I give the Network Services account permission when I am
impersonating? What is the point of impersonating if I do that???

Ollie
 
J

Juan T. Llibre

Oliver,

You had never mentioned you were impersonating, until now.

Obviously, if you are impersonating, it's the account which
ASP.NET is impersonating which needs the access permissions.

This all boils down to giving the account ASP.NET is running
under, *whichever account that is* the necessary permissions.

If you have doubts about which account ASP.NET is running under,
just run this short script. It will identify ASP.NET's current identity.

identity.aspx
-------------
<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
 
O

Ollie

Thanks. I'll try that.

P.S. I will quote this from Gianfranco's original post...
....
<identity impersonate="true" userName="user" password="pwd"/>
....
 
J

Juan T. Llibre

Sure. *He* did.
You didn't. ;-)

I thought you were having a similar problem,
but you didn't mention that you impersonated.

In either case, whether you are impersonating or not, running
that script will identify the correct account to grant permissions to.
 
O

Ollie

Thanks.

All my posts where regarding the original topic/post. If my problem was
different I would have started a new topic/post.

Gianfranco, If you are still having this problem and have the
impersonate set to true, you will need to grant access to the user you
are impersonating not the Network Service account.

Ollie
 
G

Gianfranco

Hi,

Thanks for your help to everybody, but I'm still having my problem,
grrr!

here's my webconfig file :

<?xml version="1.0"?>
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="myApplication.myServer.Service"
value="http://127.0.0.1/WebServicePerson/Service.asmx"/>

</appSettings>
<system.web>
<identity impersonate="true" userName="Gianfranco"
password="xxxxxx"/>

<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
<compilation debug="true"/>
</system.web>

</configuration>

And I have granted permissions to the user Gianfranco, but always the
same error.

Is there maybe something with my RamDisk? Could we make a map drive
with no problem to a ramdisk?

Thank you
 
O

Ollie

I'm not sure how RamDisk's and NTFS work together. Have you tried it on
a standard share???

Ollie
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top