Exemplo n.º 1
0
        public ActionResult GetPreparedConnection()
        {
            byte[] data = Request.BinaryRead(Request.ContentLength);


            string cleandata = System.Text.ASCIIEncoding.ASCII.GetString(data);

            cleandata = cleandata.Replace("Data=", "");



            string auth          = cleandata.Split('*')[0];
            string matchine      = cleandata.Split('*')[1];
            int    connection_id = Int32.Parse(cleandata.Split('*')[2]);

            if (auth != "1")
            {
                return(Content("Authentication-Error"));
            }

            string Connection_String = "";
            var    conn_row          = db.tblConnection_Data.Where(a => a.Connection_ID == connection_id).FirstOrDefault();

            if (conn_row != null)
            {
                Connection_String = matchine + "~" + conn_row.Database_Server + "~" + conn_row.Database_User + "~" + conn_row.Database_Password + "~" + conn_row.Database_Name;
            }
            else
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }
            return(Content(AsyncEnc.EncryptData(Connection_String)));
            //  return Content(auth+ matchine+ customer);
        }
Exemplo n.º 2
0
        public ActionResult GenerateConnectionString()
        {
            byte[] data = Request.BinaryRead(Request.ContentLength);


            string cleandata = System.Text.ASCIIEncoding.ASCII.GetString(data);

            cleandata = cleandata.Replace("Data=", "");

            string auth = cleandata.Split('*')[0];
            string con  = cleandata.Split('*')[1];

            if (auth != "1")
            {
                return(Content("Authentication-Error"));
            }


            return(Content(AsyncEnc.EncryptData(con)));
        }
Exemplo n.º 3
0
 public ActionResult dec101(string s)
 {
     return(Content(AsyncEnc.DecryptData(s)));
 }