Exemplo n.º 1
0
        /// <summary>
        /// Hash must be unique. REMOVES ASHX handler on client side
        /// RUN FROM ADMIN PANEL
        /// </summary>
        /// <param name="Hash"></param>
        public static void RemoveHandler(string Hash)
        {
            //Send request to proper handler
            string url  = AppSettings.Site.Url + HANDLER_LOCATION;
            string data = String.Format("?h={0}&p={1}&r=1", Hash, HashingManager.GenerateSHA256(AppSettings.Offerwalls.UniversalHandlerPassword));

            using (WebClient MyWebClient = new MyWebClient())
            {
                string resultStr = MyWebClient.DownloadString(url + data);

                //All OK
                if (resultStr == RESPONSE_OK_CODE)
                {
                    return;
                }

                //Errors
                if (resultStr == RESPONSE_ERROR_CODE)
                {
                    throw new MsgException("There was a problem with removing ASHX handler. MAKE SURE that you enabled write permissions to "
                                           + AppSettings.Site.Url + HANDLER_LOCATION + ", " + "~/" + HANDLER_FOLDER + " directory and all subdirectories and try again.");
                }
                else
                {
                    throw new MsgException("!" + resultStr);
                }
            }
        }
Exemplo n.º 2
0
    protected void changeSettings_AvatarUploadSubmit_Click(object sender, EventArgs e)
    {
        if (Page.IsValid && changeSettings_AvatarUpload.HasFile)
        {
            newTemporaryBanner.Save("~/Images/Avatars/", HashingManager.GenerateSHA256(Member.CurrentName));

            User.AvatarUrl = newTemporaryBanner.Path;
            User.Save();

            changeSettings_AvatarUpload.Dispose();

            AvatarImage.ImageUrl = string.Format("{0}?{1}", User.AvatarUrl, AppSettings.ServerTime);
        }
    }
Exemplo n.º 3
0
    private static List <string> HashAllPTCAdsIds(List <PtcAdvert> listOfAds)
    {
        var listOfAdsIds    = new List <int>();
        var listOfAdsHashes = new List <string>();

        foreach (PtcAdvert item in listOfAds)
        {
            listOfAdsIds.Add(item.Id);
        }
        foreach (int id in listOfAdsIds)
        {
            string stringToHash = id + AppSettings.Offerwalls.UniversalHandlerPassword + DateTime.Now.ToShortDateString();
            listOfAdsHashes.Add(HashingManager.GenerateSHA256(stringToHash));
        }
        return(listOfAdsHashes);
    }
Exemplo n.º 4
0
    public static string HashAd(string watchedId)
    {
        string stringToHash = watchedId + AppSettings.Offerwalls.UniversalHandlerPassword + DateTime.Now.ToShortDateString();

        return(HashingManager.GenerateSHA256(stringToHash));
    }