Clearing previous image from Cache

11 posts, 0 answers
  1. Paul Robertson
    Paul Robertson avatar
    78 posts
    Member since:
    May 2010

    Posted 10 Jan 2013 Link to this post

    Hi there

    Does anyone know if there is a way to tell radCaptcha to start from scratch and ignore any existing images in the Cache? I'm thinking that during development, when I'm hitting lots of new page loads, that previous images in the cache might be causing a trouble I have with intermittent blank Captcha images.

    Could anybody advise if this is a useful way forward?

    Thanks

     
  2. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 14 Jan 2013 Link to this post

    Hello Paul,

    There was a problem with clearing the previous RadCaptcha images from Cache or Session, when the page is reloaded without postback, as described here. This issue has been fixed, so I would suggest upgrading to the latest release of the RadControls for ASP.NET AJAX.

    If this is not the problem you encountered, please provide a detailed description of your scenario with step by step instructions for reproducing the issue so that I can help you accordingly.

    Kind regards,
    Slav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Paul Robertson
    Paul Robertson avatar
    78 posts
    Member since:
    May 2010

    Posted 14 Jan 2013 Link to this post

    Hi there

    I'd be interested to read the post that you link to, in case in contains any scope for a workaround. However, the Public Issue Tracker page you link to just shows a blank page, in all the browsers I have tried. I have Silverlight installed, so can I check that this link is going to the right location?

    Regards
  5. Paul Robertson
    Paul Robertson avatar
    78 posts
    Member since:
    May 2010

    Posted 15 Jan 2013 Link to this post

    Hi there

    Thanks for getting back to me about this, but really I was looking for some way of working around the issue, e.g., for example, explicitly removing a Cache or Session key entry on the first load of a page, regardless of any previous postbacks - is there really no way of examining the radCaptcha specific contents of the relevant Cache item, for example, in order to include a decision whether or not to ignore it, within an IsPostback condition? There doesn't seem to be a Cache item related to the Captcha control on the first new load of the page, so I am interested to know if there is any other way of detecting the GUID conflict bug in the version of Telerik.Web.UI that I am using. I can work with a custom version of the custom control, i.e., inheriting from radCaptcha, if that is any use at all?

    Thanks
  6. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 17 Jan 2013 Link to this post

    Hi Paul,

    The best way to resolve your problem is to upgrade to the latest version of RadControls for ASP.NET AJAX. If this is not possible, you can use the workaround, provided in the linked forum thread in order to always clear the previous RadCaptcha images from Session/Cache.

    I checked the link and it appears to be valid, nevertheless it could take some time to load the page.

    Greetings,
    Slav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  7. Paul Robertson
    Paul Robertson avatar
    78 posts
    Member since:
    May 2010

    Posted 17 Jan 2013 Link to this post

    Hello again

    The workaround seems to be just what I need, so thanks for that, but unfortunately after a few hours experimentation, I still can't get it to work:

        protected override void Render(HtmlTextWriter writer)
        {
            RemovePrevCaptchaImage();
             base.Render(writer);
        }
     
        private void RemovePrevCaptchaImage()
        {
            if (!IsPostBack)
            {
                var id = Session[RadCaptcha1.UniqueID] as string;
                if (!string.IsNullOrEmpty(id))
                {
                    Session.Remove(id);
                }
            }
            Session[RadCaptcha1.UniqueID] = RadCaptcha1.CaptchaImage.UniqueId;
        }

    Although:
         Session[RadCaptcha1.UniqueID] = RadCaptcha1.CaptchaImage.UniqueId;
    seems to be correctly saving the key to the session, increasing the key count accordingly, when I then go on to load the page in another tab or instance, for example, the
              if (!string.IsNullOrEmpty(id))
    always returns null, as though the saved key cannot be found in the session after all, upon the next attempt by the browser. I currently have a session cookie (cookieless="false") and the default server side InProc session configured in web.config. Should I expect the CaptchaImage ID to be saved in the session correctly with this combination?

    Thanks if you can advise.


  8. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 22 Jan 2013 Link to this post

    Hello Paul,

    The Session is shared between the browser tabs so the UniqueID of the captcha image should be available if you open the page in a new tab. Your Session configuration is a standard one and you should not have problems with storing the id.

    I would suggest checking for custom code that clears the Session of your application. If you are unable you find it, you can create a clean web site that contains only a page with the captcha, apply the workaround, verify that the values in Session are stored correctly and compare it to your actual project.

    Kind regards,
    Slav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  9. Paul Robertson
    Paul Robertson avatar
    78 posts
    Member since:
    May 2010

    Posted 24 Jan 2013 Link to this post

    Thanks for that info ...

    I'm wondering if my problem does indeed concern the issue you suggest, involving the creation of a new session id for each and every tab in the browser. I am currently using the ASP.NET session cookie method of maintaining a session, and I am thinking that the way the radcaptcha control references its captchaimage might be conflicting with the use of the session cookie. Each load of the page uses a session cookie with the same name, and if the cookie is already there from a previous load cycle, is the client-side capcha component looking for a reference in this previously created cookie, and therefore becoming confused? How should I expect the racaptcha to work with the session cookie? Presumably the captcha image itself is not stored in any form in the cookie, at best would it just be a reference to a server-side object? If I examine the session cookie, what information should I expect to see saved in the session cookie by the radcaptcha component, and am I right in assuming that no changes to the captchaimage object are ever made by the client-side component, and can only be manipulated with the server-side API, even in the most recent version of Telerik.Web.UI? It doesn't seem to matter which version I use, I am still getting bank images, which makes me think that I have misunderstood the way radCaptcha uses the session - the problem occurs using only a single server, so is not a web farm issue. Would it be possible to get a brief breakdown of how the radCaptcha should interact with the session cookie? There doesn't seem to be any information about the detais of this in any of the documentation.

    Thanks very much.
  10. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 29 Jan 2013 Link to this post

    Hello Paul,

    The RadCaptcha is making changes to the content of the session, which is stored on the server. The session cookie is used for storing the SessionID value, which uniquely identifies the session as described in this article.

    Every time the page is loaded, as a result of a postback or when a new page is opened, the captcha checks if there is a CaptchaImage stored in the Session, removes it and saves in Session the newly generated CaptchaImage. The image in Session is used when the captcha is rendered on the page. The fact that the image is missing means that there is something interfering with the logic, used by the captcha.

    Also keep in mind that all of this is executed on the server. The captcha does not provide client-side validation.

    In order to find the cause I will need to examine your implementation as the provided information is not enough to pinpoint the issue. I would suggest preparing and sending a simple, fully runnable project that isolates the problem so that I can inspect it locally and assist you accordingly.

    Greetings,
    Slav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  11. Paul Robertson
    Paul Robertson avatar
    78 posts
    Member since:
    May 2010

    Posted 07 Feb 2013 Link to this post

    Thanks for this information ...

    When you say this ...
    "Every time the page is loaded, as a result of a postback or when a new page is opened, the captcha checks if there is a CaptchaImage stored in the Session, removes it and saves in Session the newly generated CaptchaImage. "

    ... could you tell me specifically where in the page life cycle this should take place, in response to which event, if possible?

    Thanks

  12. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 12 Feb 2013 Link to this post

    Hi Paul,

    This happens on the PreRender event of the RadCaptcha only when the page is not loaded as a response of a client postback.

    There is another forum thread that you have opened, which appears to be related to this one. Let us continue our discussion in only one of the threads as the information on the case will be easier to follow.

    Greetings,
    Slav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017