예제 #1
0
        /// <summary>
        ///     Method used to resolve the RESTful URL for Entities and Relationships.  The Profiles framwork contains a database stored procedure that is used to process
        ///   the application and 9 URL parameters in the RESTful URL Pattern that is defined in the RegisterRoutes method of the Global.asax file.
        ///
        /// </summary>
        /// <param name="applicaitonname"> the applictionname is Param0 in the RESTful URL pattern in the Global.asax file.  The default install of Profiles has an application name of "profile"</param>
        /// <param name="param1">Param1 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param2">Param2 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param3">Param3 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param4">Param4 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param5">Param5 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param6">Param6 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param7">Param7 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param8">Param8 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param9">Param9 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="sessionid">The Profiles custom SessionID used to track the users navigation and activity that is stored as a Profiles Network.</param>
        /// <returns></returns>
        public URLResolve GetResolvedURL(string applicationname,
                                         string param1,
                                         string param2,
                                         string param3,
                                         string param4,
                                         string param5,
                                         string param6,
                                         string param7,
                                         string param8,
                                         string param9,
                                         string sessionid,
                                         string resturl,
                                         string useragent,
                                         string contenttype)
        {
            //Add the URL from the browser and then the full

            URLResolve rtn = null;

            try
            {
                SqlParameter[] param = new SqlParameter[14];
                param[0]  = new SqlParameter("@ApplicationName", applicationname);
                param[1]  = new SqlParameter("@param1", param1);
                param[2]  = new SqlParameter("@param2", param2);
                param[3]  = new SqlParameter("@param3", param3);
                param[4]  = new SqlParameter("@param4", param4);
                param[5]  = new SqlParameter("@param5", param5);
                param[6]  = new SqlParameter("@param6", param6);
                param[7]  = new SqlParameter("@param7", param7);
                param[8]  = new SqlParameter("@param8", param8);
                param[9]  = new SqlParameter("@param9", param9);
                param[10] = new SqlParameter("@SessionID", sessionid);
                param[11] = new SqlParameter("@resturl", resturl);
                param[12] = new SqlParameter("@useragent", useragent);
                param[13] = new SqlParameter("@ContentType", contenttype);

                using (SqlDataReader dbreader = GetSQLDataReader(GetDBCommand("", "[Framework.].[ResolveURL]", CommandType.StoredProcedure, CommandBehavior.CloseConnection, param)))
                {
                    dbreader.Read();

                    rtn = new URLResolve(Convert.ToBoolean(dbreader["Resolved"]), dbreader["ErrorDescription"].ToString(), dbreader["ResponseURL"].ToString(),
                                         dbreader["ResponseContentType"].ToString(), dbreader["ResponseStatusCode"].ToString(), Convert.ToBoolean(dbreader["ResponseRedirect"]), Convert.ToBoolean(dbreader["ResponseIncludePostData"]));
                }
            }
            catch (Exception ex)
            {
                if (rtn == null)
                {
                    rtn = new URLResolve(false, "error with data", "", "", "", false, false);
                }
                Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace);
            }



            return(rtn);
        }
예제 #2
0
        /// <summary>
        ///     Method used to resolve the RESTful URL for Entities and Relationships.  The Profiles framwork contains a database stored procedure that is used to process
        ///   the application and 9 URL parameters in the RESTful URL Pattern that is defined in the RegisterRoutes method of the Global.asax file.
        ///   
        /// </summary>
        /// <param name="applicaitonname"> the applictionname is Param0 in the RESTful URL pattern in the Global.asax file.  The default install of Profiles has an application name of "profile"</param>
        /// <param name="param1">Param1 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param2">Param2 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param3">Param3 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param4">Param4 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param5">Param5 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param6">Param6 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param7">Param7 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param8">Param8 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="param9">Param9 in the RESTful URL pattern in the RegisterRoutes method of the Global.asax file</param>
        /// <param name="sessionid">The Profiles custom SessionID used to track the users navigation and activity that is stored as a Profiles Network.</param>
        /// <returns></returns>
        public URLResolve GetResolvedURL(string applicationname,
                                        string param1,
                                        string param2,
                                        string param3,
                                        string param4,
                                        string param5,
                                        string param6,
                                        string param7,
                                        string param8,
                                        string param9,
                                        string sessionid,
                                        string resturl,
                                        string useragent,
                                        string contenttype)
        {
            //Add the URL from the browser and then the full

            URLResolve rtn = null;

            try
            {
                SqlDataReader dbreader;
                SqlParameter[] param = new SqlParameter[14];
                param[0] = new SqlParameter("@ApplicationName", applicationname);
                param[1] = new SqlParameter("@param1", param1);
                param[2] = new SqlParameter("@param2", param2);
                param[3] = new SqlParameter("@param3", param3);
                param[4] = new SqlParameter("@param4", param4);
                param[5] = new SqlParameter("@param5", param5);
                param[6] = new SqlParameter("@param6", param6);
                param[7] = new SqlParameter("@param7", param7);
                param[8] = new SqlParameter("@param8", param8);
                param[9] = new SqlParameter("@param9", param9);
                param[10] = new SqlParameter("@SessionID", sessionid);
                param[11] = new SqlParameter("@resturl", resturl);
                param[12] = new SqlParameter("@useragent", useragent);
                param[13] = new SqlParameter("@ContentType", contenttype);

                dbreader = GetSQLDataReader(GetDBCommand("", "[Framework.].[ResolveURL]", CommandType.StoredProcedure, CommandBehavior.CloseConnection, param));
                dbreader.Read();

                rtn = new URLResolve(Convert.ToBoolean(dbreader["Resolved"]), dbreader["ErrorDescription"].ToString(), dbreader["ResponseURL"].ToString(),
                    dbreader["ResponseContentType"].ToString(), dbreader["ResponseStatusCode"].ToString(), Convert.ToBoolean(dbreader["ResponseRedirect"]), Convert.ToBoolean(dbreader["ResponseIncludePostData"]));

                //Always close your readers
                if (!dbreader.IsClosed)
                    dbreader.Close();

            }
            catch (Exception ex)
            {
                if (rtn == null)
                {
                    rtn = new URLResolve(false, "error with data", "", "", "", false, false);
                }
                Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace);
            }

            return rtn;
        }