.NET Programming

.NET class for UNC network authentication

Keywords: NETRESOURCE UNC network authentication class WNetAddConnection2



cialis controindicazioni


cialis generico 5 mg

cialis pillola gialla link

viagra cena lekaren

viagra prodej cena

prednisolon kol

prednisolon 5 mg click

viagra prodej praha

viagra generika open

antidepressants and drinking alcohol

antidepressants and alcohol consumption developersalley.com

where can you buy the abortion pill

can i buy the abortion pill over the counter

the effects of alcohol and antidepressants

effects of alcohol and antidepressants go

generico cialis

cialis originale website

cialis generic

generic for cialis lasertech.com

how much will generic viagra cost

when will generic viagra be available hutoncallsme.azurewebsites.net

cialis cena v lekarne

cialis cena v lekarni website

viagra generika

viagra cena dr max website-knowledge.com

viagra cena lekaren

viagra prodej read here

sertraline and alcohol

sertraline 50 mg and alcohol online

naltrexone and naloxone

potency of naloxone and naltrexone tracyawheeler.com

prednisolon kur

prednisolon bivirkninger hund read here

naltrexone wiki

naltrexone fibromyalgi saveapanda.com

cialis cena 2018

cialis cena 2018 eteam.ou.edu

coupon for prescriptions

discount coupons for cialis partickcurlingclub.co.uk

how naltrexone works

what is naltrexone prescribed for azpodcast.azurewebsites.net

amantadin 50 mg

amantadin kullanimi amantadin antiviral amantadin yan etkileri




        public int dwScope;

        public int dwType;

        public int dwDisplayType;

        public int dwUsage;

        public string LocalName;

        public string RemoteName;

        public string Comment;

        public string Provider;



    public class UNCConnect




        private static extern int WNetAddConnection2([In] NETRESOURCE netResource,

           string password, string username, int flags);


        [DllImport("mpr.dll", CharSet = CharSet.Ansi)]

        private static extern int WNetCancelConnection2(string astring, int flags, bool force);


        public UNCConnect()



            // TODO: Add constructor logic here




        public string Connect(string computer, string username, string password)


            NETRESOURCE myNetResource = new NETRESOURCE();

            myNetResource.dwScope = 2;

            myNetResource.dwType = 1;

            myNetResource.dwDisplayType = 3;

            myNetResource.dwUsage = 1;

            myNetResource.RemoteName = computer;

            myNetResource.Provider = null;


            WNetCancelConnection2(myNetResource.RemoteName, 0, true);


            int ret = WNetAddConnection2(myNetResource, password, username, 0);

            if (ret != 0)


                switch (ret)


                    case 5:  //ERROR_ACCESS_DENIED

                        return "Access Denied";

                    case 85:   // ERROR_ALREADY_ASSIGNED =

                        return "The Drive is already assigned";

                    case 66:   // ERROR_BAD_DEV_TYPE

                        return "Bad Device type";

                    case 1200: // ERROR_BAD_DEVICE

                        return "Bad Device";

                    case 67:   // ERROR_BAD_NET_NAME

                        return "Bad Net Name";

                    case 1206: // ERROR_BAD_PROFILE

                        return "Bad Profile";

                    case 1204: //  ERROR_BAD_PROVIDER

                        return "Bad Provider";

                    case 170:  // ERROR_BUSY

                        return "Busy";

                    case 1223: // ERROR_CANCELLED

                        return "Cancelled";

                    case 1205: // ERROR_CANNOT_OPEN_PROFILE

                        return "Cannot open Profile";

                    case 1202: // ERROR_DEVICE_ALREADY_REMEMBERED

                        return "Device Already Remember";

                    case 1208: // ERROR_EXTENDED_ERROR

                        return "Extended Error";

                    case 86:   // ERROR_INVALID_PASSWORD

                        return "Invalid Password";

                    case 1203: // ERROR_NO_NET_OR_BAD_PATH

                        return "No Net or Bad Path";

                    case 1312:  // ERROR_NO_SUCH_LOGON_SESSION

                        return "The specified logon session does not exist";


                        return "Unknown Error " + ret +


 PTerryWave LLC      Return to Programming Listing