Resolving UNC path using hosts file
Solution 1
I found this article that explains what you can do to make aliases for localhost's UNC path. I was having a similar problem to the one you are having and did as the article explained, with a succesful result.
Solution 2
Try adding
10.x.x.x server_1
to %SYSTEM32%\drivers\etc\LMHOSTS
(Note this file doesn't exist by default)
LMHOSTS is to unc paths as HOSTS is to TPC/IP paths.
More info here http://technet.microsoft.com/en-us/library/cc959846.aspx
Related videos on Youtube
Mika.Ko
Updated on September 18, 2022Comments
-
Mika.Ko almost 2 years
What is the best approach to use downloaded image as photo in Navigation Drawer (or any other layout)?
To be more specific I'll tell the whole idea - I have 2 Activities, first of them give user opportunity to login with usage of 3d part SDK, if login was successful app receive JSON Obj with user name and url of his avatar, then second Activity is shown, where user could call Navigation Drawer. So I need to download photo with the provided url and show it in the Nav Drawer.
For downloading I'm currently using Picasso:
Picasso.with(getApplicationContext()).load(URL).into(target);
Than I'm loading this image into the view in the RecyclerViewAdapter like this:
Picasso.with(cntx).load(new File(cntx.getFilesDir() + "/photo.png")).into(imgView);
But I'm not sure that I'm doing all this stuff in the right way and there are exist some other more rigth approach.
-
Nanne about 13 yearsCorrect me if I'm wrong, but "server_1" in your
\\server_1
example isn't actually a domain name, so it wouldn't go "trough" your hosts file, would it? -
Marcin Orlowski about 9 yearsSince for the 2nd time you use cached image then I do not see much problem with this approach
-
-
Admin about 13 yearsHi, I tried removing the underscore but its still not working. I am pretty sure it is not a name problem because I can call webservices with that name. For example:
http://server_1/mywebservice/service.asmx
works fine. But when using UNC file paths, it doesn't seem to be using the hosts file to resolve the name=/ -
Joe Enos about 12 yearsI had the exact same issue, and this worked perfectly for me. Thanks for the link.
-
Kip over 7 yearsIn both my
hosts
andlmhosts
file I have:127.0.0.1 whatever
. When I try to rundir \\whatever\C$\temp
I get:The user name or password is incorrect.
. Any idea why? When I use an IP it works fine with no prompt for password:dir \\127.0.0.1\C$\temp
-
Jeremy almost 4 yearsI get the same error as @Kip. I'm guessing there's something in our network security preventing this because the request and actual server names don't match. I just wish I knew how to make a security exception for this one test machine.