472,951 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,951 software developers and data experts.

grabbing UNC path from asp.net multipart form browse

DMG
I have <identity impersonate = "true" /& <authentication
mode="Windows"/in the web.config. This is a 2.0 site. My Goal: I
want to simply have the user browse to a file on a mapped drive and get
the UNC for that file and eventually save that unc path to the database
as a link. The problem is depending on office we have the same drive
letter mapped to different servers.

My current test works when I run everything locally and maps correctly
to even a network drive. It fails when I deploy to a production server
with the following error.

Error:
System.Web.HttpUnhandledException: Exception of type
'System.Web.HttpUnhandledException' was thrown. --->
System.Runtime.InteropServices.COMException (0x800A0044): Exception
from HRESULT: 0x800A0044 (CTL_E_DEVICEUNAVAILABLE)
at Scripting.FileSystemObjectClass.GetDrive(String DriveSpec)

asp.net 2.0 c# Code:
string sTemp = filepath.Value.ToString(); // mapped drive/file
input string
Scripting.FileSystemObject FSO = new
Scripting.FileSystemObject();
Scripting.Drive Drive = FSO.GetDrive(sTemp.Substring(0, 2));
<== error line

...

I have tried to impersonate an account (using advapi32.dll LogonUser())
that has heightened authority but that fails as well - I can provide
details . Perhaps I am just missing the right setting on that account.

Thanks in advance for any help.

Jan 15 '07 #1
4 3063
1) You likely don't have any more to use Scripting.fileSystemObject. See
System.IO that should provide similar .NET based capabilities.

2) It looks like to me you are trying to access a drive letter server side.
This driver letter likely doesn't exists server side...

So :
- I would try first with something constant that should work (use
FSO.GetDrive("e:") or print out sTemp.Substring(0,2) to be sure to do what
you expect).
- I'm not sure how it could be solved. The drive letter to UNC resolution
can only be done IMO client side as this is workstation specific.

Or is it that you try to use Scripting.FileSystemobject client side ? Keep
in mind that the ASPX page runs server side. To do so you would have to
inject client side code in your page plus likely to alter security
settings...

----
Patrice

"DMG" <Da**********@gmail.coma écrit dans le message de news:
11**********************@q2g2000cwa.googlegroups.c om...
>I have <identity impersonate = "true" /& <authentication
mode="Windows"/in the web.config. This is a 2.0 site. My Goal: I
want to simply have the user browse to a file on a mapped drive and get
the UNC for that file and eventually save that unc path to the database
as a link. The problem is depending on office we have the same drive
letter mapped to different servers.

My current test works when I run everything locally and maps correctly
to even a network drive. It fails when I deploy to a production server
with the following error.

Error:
System.Web.HttpUnhandledException: Exception of type
'System.Web.HttpUnhandledException' was thrown. --->
System.Runtime.InteropServices.COMException (0x800A0044): Exception
from HRESULT: 0x800A0044 (CTL_E_DEVICEUNAVAILABLE)
at Scripting.FileSystemObjectClass.GetDrive(String DriveSpec)

asp.net 2.0 c# Code:
string sTemp = filepath.Value.ToString(); // mapped drive/file
input string
Scripting.FileSystemObject FSO = new
Scripting.FileSystemObject();
Scripting.Drive Drive = FSO.GetDrive(sTemp.Substring(0, 2));
<== error line

...

I have tried to impersonate an account (using advapi32.dll LogonUser())
that has heightened authority but that fails as well - I can provide
details . Perhaps I am just missing the right setting on that account.

Thanks in advance for any help.

Jan 15 '07 #2
DMG
Patrice,

Thanks for your response. I am indeed trying to resolve the client's
drive reference mapping to a UNC path. My goal is related to uploading
a file from a client workstation and they are browsing to a network
resource on a mapped drive. They choose a file to upload but in my case
I just want the UNC path to that resource to save as a link - I do not
want to copy the file just how to get to it as a UNC.

Regards,
dmg

Patrice wrote:
1) You likely don't have any more to use Scripting.fileSystemObject. See
System.IO that should provide similar .NET based capabilities.

2) It looks like to me you are trying to access a drive letter server side.
This driver letter likely doesn't exists server side...

So :
- I would try first with something constant that should work (use
FSO.GetDrive("e:") or print out sTemp.Substring(0,2) to be sure to do what
you expect).
- I'm not sure how it could be solved. The drive letter to UNC resolution
can only be done IMO client side as this is workstation specific.

Or is it that you try to use Scripting.FileSystemobject client side ? Keep
in mind that the ASPX page runs server side. To do so you would have to
inject client side code in your page plus likely to alter security
settings...

----
Patrice

"DMG" <Da**********@gmail.coma écrit dans le message de news:
11**********************@q2g2000cwa.googlegroups.c om...
I have <identity impersonate = "true" /& <authentication
mode="Windows"/in the web.config. This is a 2.0 site. My Goal: I
want to simply have the user browse to a file on a mapped drive and get
the UNC for that file and eventually save that unc path to the database
as a link. The problem is depending on office we have the same drive
letter mapped to different servers.

My current test works when I run everything locally and maps correctly
to even a network drive. It fails when I deploy to a production server
with the following error.

Error:
System.Web.HttpUnhandledException: Exception of type
'System.Web.HttpUnhandledException' was thrown. --->
System.Runtime.InteropServices.COMException (0x800A0044): Exception
from HRESULT: 0x800A0044 (CTL_E_DEVICEUNAVAILABLE)
at Scripting.FileSystemObjectClass.GetDrive(String DriveSpec)

asp.net 2.0 c# Code:
string sTemp = filepath.Value.ToString(); // mapped drive/file
input string
Scripting.FileSystemObject FSO = new
Scripting.FileSystemObject();
Scripting.Drive Drive = FSO.GetDrive(sTemp.Substring(0, 2));
<== error line

...

I have tried to impersonate an account (using advapi32.dll LogonUser())
that has heightened authority but that fails as well - I can provide
details . Perhaps I am just missing the right setting on that account.

Thanks in advance for any help.
Jan 15 '07 #3
Ok, so as I said earlier it looks like to me you are trying to do this
server side where the client computer letter drive mappings are not known.
Is this that ?

If yes, you must do this client side using JavaScript code. Give it a try
and open a new thread if you have some difficulties (likely you'll have to
alter first the secuirty settings, for example by putting this site in the
"trusted" zone). You must run Scripting.FileSystemObject *client side*.

Also as I said ealier before doing the actual coding, just write bare bone
code for a proof of concept (basically a javascript code that is hosted in a
web page and find out the mapping for you e: drive or whatever letter you
want). It will likely help you to see the big picture before dealing with
details...

Also you'll have this likely in many more occasion if they have each their
own mapping. It could perhaps be worth to see if it can be standardized...

Good luck.

Patrice

"DMG" <Da**********@gmail.coma écrit dans le message de news:
11**********************@v45g2000cwv.googlegroups. com...
Patrice,

Thanks for your response. I am indeed trying to resolve the client's
drive reference mapping to a UNC path. My goal is related to uploading
a file from a client workstation and they are browsing to a network
resource on a mapped drive. They choose a file to upload but in my case
I just want the UNC path to that resource to save as a link - I do not
want to copy the file just how to get to it as a UNC.

Regards,
dmg

Patrice wrote:
1) You likely don't have any more to use Scripting.fileSystemObject. See
System.IO that should provide similar .NET based capabilities.

2) It looks like to me you are trying to access a drive letter server
side.
This driver letter likely doesn't exists server side...

So :
- I would try first with something constant that should work (use
FSO.GetDrive("e:") or print out sTemp.Substring(0,2) to be sure to do what
you expect).
- I'm not sure how it could be solved. The drive letter to UNC resolution
can only be done IMO client side as this is workstation specific.

Or is it that you try to use Scripting.FileSystemobject client side ? Keep
in mind that the ASPX page runs server side. To do so you would have to
inject client side code in your page plus likely to alter security
settings...

----
Patrice

"DMG" <Da**********@gmail.coma écrit dans le message de news:
11**********************@q2g2000cwa.googlegroups.c om...
I have <identity impersonate = "true" /& <authentication
mode="Windows"/in the web.config. This is a 2.0 site. My Goal: I
want to simply have the user browse to a file on a mapped drive and get
the UNC for that file and eventually save that unc path to the database
as a link. The problem is depending on office we have the same drive
letter mapped to different servers.

My current test works when I run everything locally and maps correctly
to even a network drive. It fails when I deploy to a production server
with the following error.

Error:
System.Web.HttpUnhandledException: Exception of type
'System.Web.HttpUnhandledException' was thrown. --->
System.Runtime.InteropServices.COMException (0x800A0044): Exception
from HRESULT: 0x800A0044 (CTL_E_DEVICEUNAVAILABLE)
at Scripting.FileSystemObjectClass.GetDrive(String DriveSpec)

asp.net 2.0 c# Code:
string sTemp = filepath.Value.ToString(); // mapped drive/file
input string
Scripting.FileSystemObject FSO = new
Scripting.FileSystemObject();
Scripting.Drive Drive = FSO.GetDrive(sTemp.Substring(0, 2));
<== error line

...

I have tried to impersonate an account (using advapi32.dll LogonUser())
that has heightened authority but that fails as well - I can provide
details . Perhaps I am just missing the right setting on that account.

Thanks in advance for any help.

Jan 15 '07 #4
DMG
Patrice,

Thanks again for your replies. I wish our drives were standardized but
that is not my call. For what it is worth I do have this working if I
run the site locally so I am able given the level of trust (I guess) to
do this without any js. To restate this: I can when running the website
locally pass the mapped drived via a multipart form browse and using
FSO.getDrive() get the UNC. It loses either its security context and
or just the fact that it is on another machine & therefore can not
resolve the mapping when I run on a production server and it hit it
remotely. (This is - as you can guess - an intranet application so if
this is just a security issue: I can get the account security setup
correctly just need to know where to do so. )

Awhile back I saw an article that presented code for getting what the
client's mapped drive really pointed to but I can no longer locate it.
Perhaps it was just client side app to begin with & had access to their
mappings instead of a web based solution. Until I solve this I have a
work around that will just force the user to indicate their location
(or get it from AD) which will give me what I know to resolve the
relative mapping.

Thanks,
DMG
Patrice wrote:
Ok, so as I said earlier it looks like to me you are trying to do this
server side where the client computer letter drive mappings are not known.
Is this that ?

If yes, you must do this client side using JavaScript code. Give it a try
and open a new thread if you have some difficulties (likely you'll have to
alter first the secuirty settings, for example by putting this site in the
"trusted" zone). You must run Scripting.FileSystemObject *client side*.

Also as I said ealier before doing the actual coding, just write bare bone
code for a proof of concept (basically a javascript code that is hosted in a
web page and find out the mapping for you e: drive or whatever letter you
want). It will likely help you to see the big picture before dealing with
details...

Also you'll have this likely in many more occasion if they have each their
own mapping. It could perhaps be worth to see if it can be standardized...

Good luck.

Patrice

"DMG" <Da**********@gmail.coma écrit dans le message de news:
11**********************@v45g2000cwv.googlegroups. com...
Patrice,

Thanks for your response. I am indeed trying to resolve the client's
drive reference mapping to a UNC path. My goal is related to uploading
a file from a client workstation and they are browsing to a network
resource on a mapped drive. They choose a file to upload but in my case
I just want the UNC path to that resource to save as a link - I do not
want to copy the file just how to get to it as a UNC.

Regards,
dmg

Patrice wrote:
1) You likely don't have any more to use Scripting.fileSystemObject. See
System.IO that should provide similar .NET based capabilities.

2) It looks like to me you are trying to access a drive letter server
side.
This driver letter likely doesn't exists server side...

So :
- I would try first with something constant that should work (use
FSO.GetDrive("e:") or print out sTemp.Substring(0,2) to be sure to do what
you expect).
- I'm not sure how it could be solved. The drive letter to UNC resolution
can only be done IMO client side as this is workstation specific.

Or is it that you try to use Scripting.FileSystemobject client side ? Keep
in mind that the ASPX page runs server side. To do so you would have to
inject client side code in your page plus likely to alter security
settings...

----
Patrice

"DMG" <Da**********@gmail.coma écrit dans le message de news:
11**********************@q2g2000cwa.googlegroups.c om...
>I have <identity impersonate = "true" /& <authentication
mode="Windows"/in the web.config. This is a 2.0 site. My Goal: I
want to simply have the user browse to a file on a mapped drive and get
the UNC for that file and eventually save that unc path to the database
as a link. The problem is depending on office we have the same drive
letter mapped to different servers.
>
My current test works when I run everything locally and maps correctly
to even a network drive. It fails when I deploy to a production server
with the following error.
>
Error:
System.Web.HttpUnhandledException: Exception of type
'System.Web.HttpUnhandledException' was thrown. --->
System.Runtime.InteropServices.COMException (0x800A0044): Exception
from HRESULT: 0x800A0044 (CTL_E_DEVICEUNAVAILABLE)
at Scripting.FileSystemObjectClass.GetDrive(String DriveSpec)
>
asp.net 2.0 c# Code:
string sTemp = filepath.Value.ToString(); // mapped drive/file
input string
Scripting.FileSystemObject FSO = new
Scripting.FileSystemObject();
Scripting.Drive Drive = FSO.GetDrive(sTemp.Substring(0, 2));
<== error line
>
...
>
I have tried to impersonate an account (using advapi32.dll LogonUser())
that has heightened authority but that fails as well - I can provide
details . Perhaps I am just missing the right setting on that account.
>
Thanks in advance for any help.
>
Jan 15 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matt | last post by:
The user can select a file in the file open dialog using <input type="FILE">, but the user can also enter the full file path in the browse text box manually. My question is if there are JavaScript...
3
by: Matt | last post by:
<input type="file" size=50"> will produce the browse button and browse text box. The user can either select the file from browse button, or enter a path in browse text box manually. My question...
4
by: John Fereira | last post by:
So, one of the limitations of multipart-form handling is that when an <input type="file" ..> tag is used it will bring up a window which allows a user to select a file for upload but won't allow...
4
by: Alex Sibilev | last post by:
Hello, I have a really weird problem I've been trying to solve it without any luck for the last couple of hours :( I'm writing a "conference board" application (quite similar to ASP.NET...
4
by: bwalke | last post by:
Help Needed Please!!! With a VB.NET web application, I am trying to save pictures and files to a directory on the web server. However, the web server is not grabbing the Posted Files. For...
4
by: kevin | last post by:
Hi, I am trying to create a page so the user can browse the network, select a file and have that file name (text) inserted into our sql DB so I can build the hyperlink path later on. Here's what...
1
by: Glenn Coyle | last post by:
Hi I am having trouble writing the file path of a image to the database,also for some reason it is not uploading the images, anyone have any ideas? the code is below: if($_POST ==...
3
by: wreed | last post by:
Is there a way on a button press to create a browse for a file box and then when they pick a file on a share drive to convert it to a UNC path and that way I would save the unc path into a table...
1
by: nad2zen | last post by:
Hi All, How to set the path value to file object using javascript. now i am trying to upload the file without using browse button, but i could not set the path value.. see my code: <form...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.