File paths (UNC, mapped drives, etc.) in a client-server environment, how to?

  • Follow


Hi,

I have an app that needs to run in a client-server environment.  That is, 
the app (MFC native) is installed on multiple workstations and accesses a 
database on a 'server'.  The app stores media file paths (video, audio, 
images, etc.) in the database.  These files need to be played on any 
workstation running the app as well as on the server.
In addition, I also have a Web app (asp.net 3.5) that needs to access the 
media files and display them in a Web page.

The app was initially designed to work on a single computer.  I need to make 
some changes so it could function in a client-server scenario.  One of the 
issues I need to deal with is file paths that are stored in a sql database.

I'm looking for some advice on what format would be most appropriate in this 
case.  I was considering an 'old' way of mapping network drives to folders. 
For example, I could make sure that each workstation as well as the server 
have M: drive mapped into a folder on the server where the files are stored. 
This would work without any code changes.  Unfortunately IIS has some issues 
with network drives so I need to look for other solution.
Another option would be to use UNC paths.  This would require quite a bit of 
work - _makepath(), _splitpath(), translation of paths to UNC in cases where 
file path is passed from drag-and-drop, standard dialogs, etc.

Has anyone gone through a similar excursive?  Any advice?

Thanks,
Bogdan


0
Reply Bogdan 2/2/2010 1:57:36 PM

See below...
On Tue, 2 Feb 2010 08:57:36 -0500, "Bogdan" <bogdan@nocompany.com> wrote:

>Hi,
>
>I have an app that needs to run in a client-server environment.  That is, 
>the app (MFC native) is installed on multiple workstations and accesses a 
>database on a 'server'.  The app stores media file paths (video, audio, 
>images, etc.) in the database.  These files need to be played on any 
>workstation running the app as well as on the server.
>In addition, I also have a Web app (asp.net 3.5) that needs to access the 
>media files and display them in a Web page.
>
>The app was initially designed to work on a single computer.  I need to make 
>some changes so it could function in a client-server scenario.  One of the 
>issues I need to deal with is file paths that are stored in a sql database.
>
>I'm looking for some advice on what format would be most appropriate in this 
>case.  I was considering an 'old' way of mapping network drives to folders. 
>For example, I could make sure that each workstation as well as the server 
>have M: drive mapped into a folder on the server where the files are stored. 
>This would work without any code changes.  Unfortunately IIS has some issues 
>with network drives so I need to look for other solution.
>Another option would be to use UNC paths.  This would require quite a bit of 
>work - _makepath(), _splitpath(), translation of paths to UNC in cases where 
>file path is passed from drag-and-drop, standard dialogs, etc.
****
I'd advise on using ONLY the UNC path representation, because there is absolutely no way
to predict what mappings any given client workstation will be using, and for this reason
it is extremely risky to store drive letters to mapped network drives.

I don't even believe in storing the UNC path, because the servers can change, for example,
if a server goes down, or if a backup server is brought online.

Frankly, I'd prefer to build a server component that exported a named pipe.  That way, you
don't even care about the server name.  The resource is a complete abstraction.  I could
use the named pipe to obtain the server name and path, and append the rest of the path in
real time.

So I'd open a named pipe of the form \\server\pipe\pipename, where I got the server name
by enumerating the available computers in turn, with a possible simplication of a default
server name which I would store in the Registry.  The "pipename" would be a GUID-based
name that returns a string of the form "\\server\share\stuff" which would tell where to
find the actual files.  This means that if one server goes down, there is a robust means
of obtaining a path to the actual data on another server.  I have actually had to
implement this in one client-server situation, because we had no idea which machine might
be the "server" on any given day.  

But if you don't want that complexity and you have a belief in the stability of the server
names and share names, you can just store the UNC name.  It is at least insensitive to
whatever mappings the currently-logged-in user is using (note that drive letter maps are
always a property of the current user, not some global state of the machine!)
				joe
****
>
>Has anyone gone through a similar excursive?  Any advice?
>
>Thanks,
>Bogdan
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
Reply Joseph 2/2/2010 5:58:18 PM


I would use a UNC, although you'll find that file access on older Windows is 
a bit slower.  It will normally your paths for mapped drives.

Take a look at:

http://msdn.microsoft.com/en-us/library/aa385474(VS.85).aspx

If you want to map a drive or folder that is shared from a local drive 
you'll have to fish around in the registry and build the path.

This might help with that:

http://www.codeguru.com/cpp/misc/misc/article.php/c3831/

Tom

"Bogdan" <bogdan@nocompany.com> wrote in message 
news:#$bv8#ApKHA.1544@TK2MSFTNGP06.phx.gbl...
> Hi,
>
> I have an app that needs to run in a client-server environment.  That is, 
> the app (MFC native) is installed on multiple workstations and accesses a 
> database on a 'server'.  The app stores media file paths (video, audio, 
> images, etc.) in the database.  These files need to be played on any 
> workstation running the app as well as on the server.
> In addition, I also have a Web app (asp.net 3.5) that needs to access the 
> media files and display them in a Web page.
>
> The app was initially designed to work on a single computer.  I need to 
> make some changes so it could function in a client-server scenario.  One 
> of the issues I need to deal with is file paths that are stored in a sql 
> database.
>
> I'm looking for some advice on what format would be most appropriate in 
> this case.  I was considering an 'old' way of mapping network drives to 
> folders. For example, I could make sure that each workstation as well as 
> the server have M: drive mapped into a folder on the server where the 
> files are stored. This would work without any code changes.  Unfortunately 
> IIS has some issues with network drives so I need to look for other 
> solution.
> Another option would be to use UNC paths.  This would require quite a bit 
> of work - _makepath(), _splitpath(), translation of paths to UNC in cases 
> where file path is passed from drag-and-drop, standard dialogs, etc.
>
> Has anyone gone through a similar excursive?  Any advice?
>
> Thanks,
> Bogdan
>
> 
0
Reply Tom 2/2/2010 10:01:06 PM

I had a similar situation and I opted to store the files in the database 
itself (image field). The files were small and not too many (thousands of 
large files is not recommended to put in the database). This solution was 
the best as I could get to the files from all my three Linux, MFC, and IIS 
applications; plus, I also added a fairly simple caching to the apps.

The UNC option was my alternative solution had it not been for Linux and the 
need for Samba and that whole mess.

Eddie.

"Bogdan" <bogdan@nocompany.com> wrote in message 
news:#$bv8#ApKHA.1544@TK2MSFTNGP06.phx.gbl...
> Hi,
>
> I have an app that needs to run in a client-server environment.  That is, 
> the app (MFC native) is installed on multiple workstations and accesses a 
> database on a 'server'.  The app stores media file paths (video, audio, 
> images, etc.) in the database.  These files need to be played on any 
> workstation running the app as well as on the server.
> In addition, I also have a Web app (asp.net 3.5) that needs to access the 
> media files and display them in a Web page.
>
> The app was initially designed to work on a single computer.  I need to 
> make some changes so it could function in a client-server scenario.  One 
> of the issues I need to deal with is file paths that are stored in a sql 
> database.
>
> I'm looking for some advice on what format would be most appropriate in 
> this case.  I was considering an 'old' way of mapping network drives to 
> folders. For example, I could make sure that each workstation as well as 
> the server have M: drive mapped into a folder on the server where the 
> files are stored. This would work without any code changes.  Unfortunately 
> IIS has some issues with network drives so I need to look for other 
> solution.
> Another option would be to use UNC paths.  This would require quite a bit 
> of work - _makepath(), _splitpath(), translation of paths to UNC in cases 
> where file path is passed from drag-and-drop, standard dialogs, etc.
>
> Has anyone gone through a similar excursive?  Any advice?
>
> Thanks,
> Bogdan
>
> 
0
Reply Eddie 2/9/2010 9:11:53 AM

This is a classic RPC C/S solution.  Keep all file storage/location 
information on the server side only. Clients know nothing. Classic 
definition of Client/Server.

Use true RPC or COM+/DCOM.

-- 
HLS


Eddie Paz wrote:

> I had a similar situation and I opted to store the files in the database 
> itself (image field). The files were small and not too many (thousands 
> of large files is not recommended to put in the database). This solution 
> was the best as I could get to the files from all my three Linux, MFC, 
> and IIS applications; plus, I also added a fairly simple caching to the 
> apps.
> 
> The UNC option was my alternative solution had it not been for Linux and 
> the need for Samba and that whole mess.
> 
> Eddie.
> 
> "Bogdan" <bogdan@nocompany.com> wrote in message 
> news:#$bv8#ApKHA.1544@TK2MSFTNGP06.phx.gbl...
>> Hi,
>>
>> I have an app that needs to run in a client-server environment.  That 
>> is, the app (MFC native) is installed on multiple workstations and 
>> accesses a database on a 'server'.  The app stores media file paths 
>> (video, audio, images, etc.) in the database.  These files need to be 
>> played on any workstation running the app as well as on the server.
>> In addition, I also have a Web app (asp.net 3.5) that needs to access 
>> the media files and display them in a Web page.
>>
>> The app was initially designed to work on a single computer.  I need 
>> to make some changes so it could function in a client-server 
>> scenario.  One of the issues I need to deal with is file paths that 
>> are stored in a sql database.
>>
>> I'm looking for some advice on what format would be most appropriate 
>> in this case.  I was considering an 'old' way of mapping network 
>> drives to folders. For example, I could make sure that each 
>> workstation as well as the server have M: drive mapped into a folder 
>> on the server where the files are stored. This would work without any 
>> code changes.  Unfortunately IIS has some issues with network drives 
>> so I need to look for other solution.
>> Another option would be to use UNC paths.  This would require quite a 
>> bit of work - _makepath(), _splitpath(), translation of paths to UNC 
>> in cases where file path is passed from drag-and-drop, standard 
>> dialogs, etc.
>>
>> Has anyone gone through a similar excursive?  Any advice?
>>
>> Thanks,
>> Bogdan
>>
>>

0
Reply Hector 2/9/2010 11:12:02 AM

4 Replies
326 Views

(page loaded in 0.135 seconds)

Similiar Articles:









7/15/2012 12:26:51 AM


Reply: