473,405 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Determine machine name of a server

Hello,

I have a .NET application through which a user can select files. This happens through the OpenFileDialog. Now, I also need to know whether that file is on my local machine or from a server. How can I find out the exact machine name from where the file is loaded, so that i can compare that with my local machine name later?

cheers,
sternchen
Oct 23 '07 #1
5 1956
Plater
7,872 Expert 4TB
What ?
Oct 23 '07 #2
Plater
7,872 Expert 4TB
The machine name for the machine running your code can be gained with Environment.MachineName

Other then that I don't know what you are getting at?
Oct 23 '07 #3
Ok :), thanks for your quick reply. I think an example helps.

The user selects a file on a server and the UNC path will look like

\\pc1234\folder\file.txt

First, I thought that I could just look for the first part which would give me the string "pc1234" but I want to have a more general. So, is their any way to find out the computer name on which that particular file is located on?

cheers
Oct 23 '07 #4
Plater
7,872 Expert 4TB
You might be able to get something from File.GetAccessControl() but I'm not sure.
Oct 23 '07 #5
For everybody with the same problem.

I found a great blog with the code which works perfectly. Check it out at
http://www.saunalahti.fi/janij/blog/2007-01.html

cheers,
sternchen
Oct 23 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

27
by: Kevin A | last post by:
Hi, Is there a way to determine the name and version of the operating system in a portable way? (for Solaris/Linux) Thanks, Kevin
8
by: Steven Van Dyke | last post by:
Hi I need a code snippet to determine if my computer is connected to a network or not. There's probably a System.Net function for it, but I cannot find it. Thanks, Steve
3
by: Danny Miller | last post by:
Hi there, I've got a web app that uses impersonation and makes calls to a SQL Server backend. I'd like to be able to automate the setting of database security for the web app upon deployment....
16
by: Jm | last post by:
Hi All Is it possible to determine who is logged onto a machine from inside a service using code in vb.net ? I have found some code that seems to work under vb6, but doesnt under .NET ? Any help...
3
by: Robin Tucker | last post by:
I'm fetching a list of SQL servers on a domain using a function that returns strings, including "(local)" for the local machine (if it has an SQL server on it). Now, presumably in a different...
3
by: Developer in California | last post by:
I am working on developing a generic Web framework using Master Pages in ASP.NET 2.0. What I have done is created a PageRenderer class which has a public method which will retrieve the path of the...
11
by: CJM | last post by:
I need to be able to determine if the user is a member of a given AD group. I have a method of doing this, but it is not suitable for 64bit OS's, so I need to find an alternative route. I actually...
2
by: Vincent | last post by:
I have been trying to find some API routines that will allow me to determine the name of the computer that is accessing a file on a server. I have found the NetFileEnum call (returns the names of...
3
by: Ken Fine | last post by:
I would like to be able to move my ASP.NET applications to any of a number of servers without changing code. My apps do a lot of disk I/O and in some cases I might be specifying absoute drive...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.