Story : 이거 땜에 스트레스 받아서 환장 했다. ㅎ-ㅎ-ㅎ-ㅎ-;;

 인터넷 접속을 통한 자동 접속 방법 1 [using System.Net;]
           
            WebRequest webreq;
            WebResponse webres;
            string url = "http://www.msn.com";

            webreq = System.Net.WebRequest.Create(url);

            bool success = false;
            try
            {
                webres = webreq.GetResponse();
                webreq.Abort();
                success = true;
            }
            catch(Exception er) {}


그리고 요청 사항이였던 이넘 ;;

OpenNETCF <-- 설치해야 한다.
http://opennetcf.com/ 에서 다운 받으면 됨

        private void typeConnection(string typeName)
        { 
            DestinationInfoCollection DIC = connMgr.EnumDestinations();
            try
            {
                foreach (DestinationInfo di in DIC)
                {
                    if (di.Description == "The Internet") // (di.Description == typeName)
                    {
                        connMgr.Connect(di.Guid, true, ConnectionMode.Asynchronous);
                    }
                }
            }
            catch (Exception er)
            {
                MessageBox.Show(er.ToString());
            }
       }

            AdapterCollection adapters = Networking.GetAdapters();

            foreach (Adapter adapter in adapters)
            {
                int ras = adapter.Name.IndexOf("RAS VPN");
                int activeSync = adapter.Name.IndexOf("Serial on USB");
                // Check if this is a GPRS/GSM/CDMA adapter
                if ((ras == -1) && (activeSync == -1) && (adapter.Type == AdapterType.PPP) && (!adapter.IsWireless))
                {
                    GPRSIPAddress = adapter.CurrentIpAddress;
                }

                ConnectionManager connMgr = new ConnectionManager();
                DestinationInfoCollection destInfoColl = connMgr.EnumDestinations();

                bool connected = false;
                foreach (DestinationInfo destInfo in destInfoColl)
                {
                    if (destInfo.Description == "Gprs connection")
                    {
                        connMgr.Connect(destInfo.Guid, true, ConnectionMode.Asynchronous);
                        while (!connected)
                        {
                            if (connMgr.Status != ConnectionStatus.Connected)
                            {
                                System.Threading.Thread.Sleep(1000);
                                continue;
                            }
                            connected = true;
                        }
                        break;
                    }
                }


            }
        }

피곤해서 색깔은 다음에 칠하자 ㅡㅡ;






Posted by penguindori