I am trying to read an .ini file to get an ip address and port to connect to while I am debugging and developing and app for windows mobile 6.5.
Here is the code I am suing but it is not finding the file. Probably not doing something correctly and that is what I am asking to find.
Code:
        public String GetIP()
        {
            try
            {
                String path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);

                using (StreamReader sr = new StreamReader(path + "\\somename.ini"))
                {
                    String line;
                    String IPAddress = "NONE";
                    while ((line = sr.ReadLine()) != null)
                    {
                        char[] delimiterChar = { '=' };

                        String[] settings = line.Split(delimiterChar);

                        String temp = settings[0];
                        String tempIP = settings[1];
                        if (temp == "IP")
                        {
                            IPAddress = tempIP;
                            return IPAddress;
                        }
                    }
                    if (IPAddress.Length > 0)
                    {
                        return IPAddress;
                    }
                    else
                    {
                        return "ERROR";
                    }
                }
            }
            catch (Exception ex)
            {
                String errMsg = ex.Message;
                return "0";
            }
        }