Link to home
Start Free TrialLog in
Avatar of JohnSingleton
JohnSingleton

asked on

asp.net -Retrieve client side UNC rather than mapped network drive when using asp:fileupload

Hello Everyone!

I think the nature of the question is simple, but i have had no luck googling or finding anything exactly what i'm after. I only hope the solution is as simple as i believe the question to be.
Here's the deal:
aspx page, c# code behind with an <asp:FileUpload /> control.
this page is used only in a local domain.  Some administrative users are going to select a file from somewhere within the intranet (a picture file), which the fileUpload will grab the file path & name and upload to SQL Server record. (the text path, not the image).  This is done so that when other users navigate to a report, page, etc. pertaining to a given individual, i can display the image by referencing the network path to the image.
simple enough and works great.
-here's the problem.

-for most users (i say most rather than 100%, because i never say 100% because you never know) have mapped network drives to these network shares.
A simplified example is:
Photos located:
\\myserver\mydir\photos\dept1\photo1.jpg

\\myserver\mydir\ is mapped to drive "X:" on the client box.

when they use the fileupload control, it returns:
X:\photos\dept1\photo1.jpg

rather than the full UNC:
\\myserver\mydir\photos\dept1\photo1.jpg

KEEP IN MIND, this is in terms of the client, the webserver doesn't even have these mapped network drives.

-I want/need this because i know someone will throw a usb drive in the machine, which will mess up the drive letters or someone's login script didn't fire on a laptop which hadn't yet established a suitable connection, etc. etc. i see a mess i'd like to avoid if i could just stick to straight UNC paths. This seems very simple, but can't find anything (either on the tag or to be called in the codebehind to get here, i'd even settle for a c# function to feed in the mapped drive letter and mine out the unc or ajax, javascript, whatever. i'm just at a loss. please help!
many thanks
-JohnSingleton
Avatar of techExtreme
techExtreme
Flag of India image

I guess it might not be possible as the file browse control is a general one and may behave differently based on the browser. Basically you can't program the default file upload control like that I suppose.
ASKER CERTIFIED SOLUTION
Avatar of JohnSingleton
JohnSingleton

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
activex may be the way to go. Replacing the x: with some path may not be reliable.