Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: I am Stuck,.... Help with System.IO


Message #1 by "Tony Arslan" <tarslan@n...> on Tue, 24 Dec 2002 08:40:32 -0600
I am Stuck,.... Hello All:
I seem to have a strange problem. I am trying to see if a directory on the
Network exist or not. I know it does exist and I know It is shared. I can
see it going from "My Network Places". But When I write the following code
It fails (It returns false) Here is the code:
		  'Itlaptop is the name of the machine on the network that I
am trying to access
		  'Tandem is the name of the shared folder
	        Dim source As DirectoryInfo = New
DirectoryInfo("\\Itlaptop\Tandem")
	        If source.Exists() Then
            	outError.Text = "Itlaptop\Tandem exists on the server."
        	  End If

		  I Also tried the other object "Directory" it failed too. 
		  Here is the code for Directory. About the same.
	        If Directory.Exists("\\Itlaptop\Tandem") Then
            	outError.Text = "Itlaptop\Tandem exists on the server."
        	  End If

Please help me. If you rather email me privately, please do so. Thanks very
much in advance. 

Note: If I use FileSystemObject (Scripting Object) I don't have this
problem. nice old days..::))

Tony Arslan

Message #2 by "Tony Arslan" <tarslan@n...> on Thu, 26 Dec 2002 09:13:06 -0600
I found a new thing...:) The code works in Windows Form but it does not 
work
on Web Forms
Just to remind you the code,.... Yes, I Imported System.IO Namespace on 
both
places...

    Private Sub btnFolderExist_Click(ByVal sender As System.Object, 
ByVal e
As System.EventArgs) Handles btnFolderExist.Click
        If Directory.Exists("\\Itlaptop\Tandem") Then
            Label1.Text =3D "Exists!!!, Hahahah!!!"
            'MessageBox.Show("Exists!")
        Else
            Label1.Text =3D "net share not found!"
            'MessageBox.Show("net share not found!")
        End If

On Windows Form, it returns "Exists!!!, Hahahah!!!"
On Web Forms, it returns "net share not found!"

I don't know what the problem is... Please help!
Thanks very much for your time..
Tony

Subject: I am Stuck,.... Help with System.IO
From: "Tony Arslan" <tarslan@n...>
Date: Tue, 24 Dec 2002 08:40:32 -0600
X-Message-Number: 2

I am Stuck,.... Hello All:
I seem to have a strange problem. I am trying to see if a directory on 
the
Network exist or not. I know it does exist and I know It is shared. I 
can
see it going from "My Network Places". But When I write the following 
code
It fails (It returns false) Here is the code:
		  'Itlaptop is the name of the machine on the network that I
am trying to access
		  'Tandem is the name of the shared folder
	        Dim source As DirectoryInfo =3D New
DirectoryInfo("\\Itlaptop\Tandem")
	        If source.Exists() Then
            	outError.Text =3D "Itlaptop\Tandem exists on the server."
        	  End If

		  I Also tried the other object "Directory" it failed too.
		  Here is the code for Directory. About the same.
	        If Directory.Exists("\\Itlaptop\Tandem") Then
            	outError.Text =3D "Itlaptop\Tandem exists on the server."
        	  End If

Please help me. If you rather email me privately, please do so. Thanks 
very
much in advance.

Note: If I use FileSystemObject (Scripting Object) I don't have this
problem. nice old days..::))

Tony Arslan


Message #3 by "Paul Riley" <rilez@t...> on Fri, 27 Dec 2002 19:23:21 -0000
It's an account privelage problem I would have thought - the asp / iusr
account does not have access to that share

-----Original Message-----
From: Tony Arslan [mailto:tarslan@n...] 
Sent: 26 December 2002 15:13
To: ASP.NET
Subject: [aspx] I am Stuck,.... Help with System.IO
Importance: High


I found a new thing...:) The code works in Windows Form but it does not
work on Web Forms Just to remind you the code,.... Yes, I Imported
System.IO Namespace on both places...

    Private Sub btnFolderExist_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnFolderExist.Click
        If Directory.Exists("\\Itlaptop\Tandem") Then
            Label1.Text = "Exists!!!, Hahahah!!!"
            'MessageBox.Show("Exists!")
        Else
            Label1.Text = "net share not found!"
            'MessageBox.Show("net share not found!")
        End If

On Windows Form, it returns "Exists!!!, Hahahah!!!"
On Web Forms, it returns "net share not found!"

I don't know what the problem is... Please help!
Thanks very much for your time..
Tony

Subject: I am Stuck,.... Help with System.IO
From: "Tony Arslan" <tarslan@n...>
Date: Tue, 24 Dec 2002 08:40:32 -0600
X-Message-Number: 2

I am Stuck,.... Hello All:
I seem to have a strange problem. I am trying to see if a directory on
the Network exist or not. I know it does exist and I know It is shared.
I can see it going from "My Network Places". But When I write the
following code It fails (It returns false) Here is the code:
		  'Itlaptop is the name of the machine on the network
that I am trying to access
		  'Tandem is the name of the shared folder
	        Dim source As DirectoryInfo = New
DirectoryInfo("\\Itlaptop\Tandem")
	        If source.Exists() Then
            	outError.Text = "Itlaptop\Tandem exists on the server."
        	  End If

		  I Also tried the other object "Directory" it failed
too. 
		  Here is the code for Directory. About the same.
	        If Directory.Exists("\\Itlaptop\Tandem") Then
            	outError.Text = "Itlaptop\Tandem exists on the server."
        	  End If

Please help me. If you rather email me privately, please do so. Thanks
very much in advance. 

Note: If I use FileSystemObject (Scripting Object) I don't have this
problem. nice old days..::))

Tony Arslan




Message #4 by Carlos Magalhaes <CarlosM@t...> on Sat, 28 Dec 2002 11:47:09 +0200
Okkkk two things :

 

a. MessageBox.show in my experience wont work on a web page, rather use
JavaScript alert for this or the alternative vbscript .

b. That net share not found , is not really the right error cause what its
actually telling you (this is if you are 100% sure that the network path
exists) the MACHINENAME\ASPNET account that is used to run the aspnet
process for that web page does not have permissions on the network share
because it's a local account.

 

Here are two solutions that have helped me,

 

Either a: in your web.config set impersonation = true , then the user(s)
that are accessing the web page need to have permissions on the share, the
best that has worked for me BUT THIS IS NOT SECURE is to enable EVERYONE to
have permissions but then again this is in a intranet environment. Or b. use
code (search MSDN for Impersonation) to use impersonation with in your code
to specify a user to run that specific code, that user then can be given the
permissions on the network share for access. 

 

Regards,

Carlos Magalhaes

 

 

-----Original Message-----
From: Tony Arslan [mailto:tarslan@n...] 
Sent: Thursday, December 26, 2002 5:13 PM
To: ASP.NET
Subject: [aspx] I am Stuck,.... Help with System.IO
Importance: High

 

I found a new thing...:) The code works in Windows Form but it does not work

on Web Forms

Just to remind you the code,.... Yes, I Imported System.IO Namespace on both

places...

 

    Private Sub btnFolderExist_Click(ByVal sender As System.Object, ByVal e

As System.EventArgs) Handles btnFolderExist.Click

        If Directory.Exists("\\Itlaptop\Tandem") Then

            Label1.Text = "Exists!!!, Hahahah!!!"

            'MessageBox.Show("Exists!")

        Else

            Label1.Text = "net share not found!"

            'MessageBox.Show("net share not found!")

        End If

 

On Windows Form, it returns "Exists!!!, Hahahah!!!"

On Web Forms, it returns "net share not found!"

 

I don't know what the problem is... Please help!

Thanks very much for your time..

Tony

 

Subject: I am Stuck,.... Help with System.IO

From: "Tony Arslan" <tarslan@n...>

Date: Tue, 24 Dec 2002 08:40:32 -0600

X-Message-Number: 2

 

I am Stuck,.... Hello All:

I seem to have a strange problem. I am trying to see if a directory on the

Network exist or not. I know it does exist and I know It is shared. I can

see it going from "My Network Places". But When I write the following code

It fails (It returns false) Here is the code:

              'Itlaptop is the name of the machine on the network that I

am trying to access

              'Tandem is the name of the shared folder

              Dim source As DirectoryInfo = New

DirectoryInfo("\\Itlaptop\Tandem")

              If source.Exists() Then

                  outError.Text = "Itlaptop\Tandem exists on the server."

              End If

 

              I Also tried the other object "Directory" it failed too. 

              Here is the code for Directory. About the same.

              If Directory.Exists("\\Itlaptop\Tandem") Then

                  outError.Text = "Itlaptop\Tandem exists on the server."

              End If

 

Please help me. If you rather email me privately, please do so. Thanks very

much in advance. 

 

Note: If I use FileSystemObject (Scripting Object) I don't have this

problem. nice old days..::))

 

Tony Arslan

 

 

 






-------------------------------------------------------------
This email and any files transmitted are
confidential and intended solely for the
use of the individual or entity to which
they are addressed, whose privacy
should be respected.  Any views or
opinions are solely those of the author
and do not necessarily represent those
of the Trencor Group, or any of its
representatives, unless specifically
stated.  

Email transmission cannot be guaranteed
to be secure, error free or without virus
contamination.  The sender therefore
accepts no liability for any errors or
omissions in the contents of this message,
nor for any virus infection that might result
from opening this message.  Trencor is not
responsible in the event of any third party
interception of this email.   

If you have received this email in error please notify
postmaster@t...   For more information about
Trencor, visit www.trencor.net <http://www.trencor.net>

















Okkkk two things :

 

a. MessageBox.show in my experience wont work on a web page, rather use
JavaScript alert for this or the alternative vbscript .

b. That net share not found , is not really the right error cause what
its actually telling you (this is if you are 100% sure that the network path
exists) the MACHINENAME\ASPNET account that is used to run the aspnet process
for that web page does not have permissions on the network share because it's
a local account.

 

Here are two solutions that have helped me,

 

Either a: in your web.config set impersonation = true , then the
user(s) that are accessing the web page need to have permissions on the share,
the best that has worked for me BUT THIS IS NOT SECURE is to enable EVERYONE to
have permissions but then again this is in a intranet environment. Or b. use
code (search MSDN for Impersonation) to use impersonation with in your code to
specify a user to run that specific code, that user then can be given the
permissions on the network share for access. 

 

Regards,

Carlos Magalhaes

 

 

-----Original Message-----
From: Tony Arslan [mailto:tarslan@n...] 
Sent: Thursday, December 26, 2002 5:13 PM
To: ASP.NET
Subject: [aspx] I am Stuck,.... Help with System.IO
Importance: High

 

I found a new thing...:) The code works in Windows Form but it does not
work

on Web Forms

Just to remind you the code,.... Yes, I Imported System.IO Namespace on
both

places...

 

    Private Sub btnFolderExist_Click(ByVal sender As
System.Object, ByVal e

As System.EventArgs) Handles btnFolderExist.Click

        If
Directory.Exists("\\Itlaptop\Tandem") Then

           
Label1.Text = "Exists!!!, Hahahah!!!"

           
'MessageBox.Show("Exists!")

        Else

           
Label1.Text = "net share not found!"

           
'MessageBox.Show("net share not found!")

        End If

 

On Windows Form, it returns "Exists!!!, Hahahah!!!"

On Web Forms, it returns "net share not found!"

 

I don't know what the problem is... Please help!

Thanks very much for your time..

Tony

 

Subject: I am Stuck,.... Help with System.IO

From: "Tony Arslan" <tarslan@n...>

Date: Tue, 24 Dec 2002 08:40:32 -0600

X-Message-Number: 2

 

I am Stuck,.... Hello All:

I seem to have a strange problem. I am trying to see if a directory on
the

Network exist or not. I know it does exist and I know It is shared. I
can

see it going from "My Network Places". But When I write the
following code

It fails (It returns false) Here is the code:

             
'Itlaptop is the name of the machine on the network that I

am trying to access

             
'Tandem is the name of the shared folder

             
Dim source As DirectoryInfo = New

DirectoryInfo("\\Itlaptop\Tandem")

             
If source.Exists() Then

                  outError.Text
= "Itlaptop\Tandem exists on the server."

              End
If

 

             
I Also tried the other object "Directory" it failed too. 

             
Here is the code for Directory. About the same.

             
If Directory.Exists("\\Itlaptop\Tandem") Then

                  outError.Text
= "Itlaptop\Tandem exists on the server."

              End
If

 

Please help me. If you rather email me privately, please do so. Thanks
very

much in advance. 

 

Note: If I use FileSystemObject (Scripting Object) I don't have this

problem. nice old days..::))

 

Tony Arslan

 

 

 









Message #5 by "Dave Buckner" <Dave@n...> on Mon, 30 Dec 2002 03:54:44 -0600
How about permissions for the aspnet account?

Dave

-----Original Message-----
From: Tony Arslan [mailto:tarslan@n...]
Sent: Thursday, December 26, 2002 9:13 AM
To: ASP.NET
Subject: [aspx] I am Stuck,.... Help with System.IO
Importance: High


I found a new thing...:) The code works in Windows Form but it does not 
work
on Web Forms Just to remind you the code,.... Yes, I Imported System.IO
Namespace on both places...

    Private Sub btnFolderExist_Click(ByVal sender As System.Object, 
ByVal e
As System.EventArgs) Handles btnFolderExist.Click
        If Directory.Exists("\\Itlaptop\Tandem") Then
            Label1.Text =3D "Exists!!!, Hahahah!!!"
            'MessageBox.Show("Exists!")
        Else
            Label1.Text =3D "net share not found!"
            'MessageBox.Show("net share not found!")
        End If

On Windows Form, it returns "Exists!!!, Hahahah!!!"
On Web Forms, it returns "net share not found!"

I don't know what the problem is... Please help!
Thanks very much for your time..
Tony

Subject: I am Stuck,.... Help with System.IO
From: "Tony Arslan" <tarslan@n...>
Date: Tue, 24 Dec 2002 08:40:32 -0600
X-Message-Number: 2

I am Stuck,.... Hello All:
I seem to have a strange problem. I am trying to see if a directory on 
the
Network exist or not. I know it does exist and I know It is shared. I 
can
see it going from "My Network Places". But When I write the following 
code
It fails (It returns false) Here is the code:
		  'Itlaptop is the name of the machine on the network that I
am trying to access
		  'Tandem is the name of the shared folder
	        Dim source As DirectoryInfo =3D New
DirectoryInfo("\\Itlaptop\Tandem")
	        If source.Exists() Then
            	outError.Text =3D "Itlaptop\Tandem exists on the server."
        	  End If

		  I Also tried the other object "Directory" it failed too.
		  Here is the code for Directory. About the same.
	        If Directory.Exists("\\Itlaptop\Tandem") Then
            	outError.Text =3D "Itlaptop\Tandem exists on the server."
        	  End If

Please help me. If you rather email me privately, please do so. Thanks 
very
much in advance.

Note: If I use FileSystemObject (Scripting Object) I don't have this
problem. nice old days..::))

Tony Arslan







  Return to Index