Mapping a network drive without hardcoding a drive letter in a batch file

If you don’t have multiple network shares connected simultaniously, you can make net use * assign a free drive letter for you. Afterwards you can use robocopy to access the share via its UNC path and release any connected share with net use * /delete. Something like this: @echo off net use * \\192.168.0.1\Share\wwwroot\MyProject /user:mydomain\myuser … Read more

IE not rendering CSS properly when the site is located at networkdrive

This sounds like that problem – where IE switches rendering modes depending on where the page is located. It’s insane. See this answer. http://127.0.0.1/mysite/mypage.php <– IE8 by default (updated!) http://localhost/mysite/mypage.php <– IE8 by default (updated!) http://machinename/mysite/mypage.php <– IE7 by default http://192.168.100.x/mysite/mypage.php <– IE7 by default http://google.com/ <– IE8 by default So, because you’re accessing your … Read more

Copy file on a network shared drive

Untested code, but it will be similiar to: AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); // http://pinvoke.net/default.aspx/advapi32/LogonUser.html IntPtr token; LogonUser(“username”, “domain”, “password”, LogonType.LOGON32_LOGON_BATCH, LogonProvider.LOGON32_PROVIDER_DEFAULT); WindowsIdentity identity = new WindowsIdentity(token); WindowsImpersonationContext context = identity.Impersonate(); try { File.Copy(@”c:\temp\MyFile.txt”, @”\\server\folder\Myfile.txt”, true); } finally { context.Undo(); }