Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7417899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:47:13+00:00 2026-05-29T07:47:13+00:00

We have a registration-type system that sends a confirmation e-mail once completed. The system

  • 0

We have a registration-type system that sends a confirmation e-mail once completed. The system had around 3000 registrations within a few minutes and we noticed a bug. If user A registers a few ms after user B has registered, user A will get user B’s details via e-mail. We did manage to fix the issue and I narrowed it down to this piece of code that gets the e-mail template from the cache and just does a string replace on a place holder.

private string ProcessEmailBody(MyRegistrationModel registration)
{
    var content = CacheHelper.GetContent("REGISTRATIONEMAIL");

    if (content != null)
    {
        content.Text = context.Text.Replace("@@FULL_NAME@@", registration.FullName);

        return content.Text;
    }
    else return null;
}

The CacheHelper.GetContent() method is static and I fixed this “bug” by doing this:

private string ProcessEmailBody(MyRegistrationModel registration)
{
    var content = CacheHelper.GetContent("REGISTRATIONEMAIL");

    if (content != null)
    {
        string body = content.Text;
        body = body.Replace("@@FULL_NAME@@", registration.FullName);

        return body;
    }
    else return null;
}

And I can’t figure out for the life of me why this has fixed the issue. Can anybody shed any light on this?

EDIT: Here’s my GetContent() method (I know the signatures are different than above, I was being brief)

public static Content GetContent(string key, int partnerSiteId, int? version, IContentRepository contentRepository, out string cacheKey)
{
    cacheKey = string.Format("{0}_{1}_{2}", key, partnerSiteId, version);

    var content = CacheManager.Get(cacheKey, () => contentRepository.GetContent(key, partnerSiteId, version), WebConfig.GetCacheDuration(CacheProfile.Short));

    return content;
}

private static DataCache _Cache = null; // DataCache is from AppFabric (Microsoft.ApplicationServer.Caching)

public static T Get<T>(string objectKey, Func<T> reloadItemExpresion, TimeSpan cacheDuration) where T : class
{
    if (_Cache == null)
    {
        if (reloadItemExpresion != null)
        {
            return reloadItemExpresion.Invoke();
        }

        return null;
    }

    object cachedObject = null;

    try
    {
        cachedObject = _Cache.Get(objectKey);
    }
    catch (Exception ex)
    {
        if (ex is FileNotFoundException)
        {
            _Cache.Remove(objectKey);
        }
    }

    if (cachedObject != null)
    {
        return cachedObject as T;
    }

    if (reloadItemExpresion != null && cacheDuration > TimeSpan.Zero)
    {
        T item = reloadItemExpresion.Invoke();

        if (item != null)
        {
            Insert(item, objectKey, cacheDuration);
        }

        return item;
    }

    return null;
}

contentRepository.GetContent just goes off to the database and fetches the actual content back.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:47:14+00:00Added an answer on May 29, 2026 at 7:47 am

    The first time through you replace the "@@FULL_NAME@@" tag in context.Text with the details of the first user. Once you do that, it never goes back to "@@FULL_NAME@@" again, so everybody gets that dude’s details until your cache is reset. You should avoid modifying objects that you get from cache:

    private string ProcessEmailBody(MyRegistrationModel registration) {
        var content = CacheHelper.GetContent("REGISTRATIONEMAIL");
        return content != null ? content.Replace("@@FULL_NAME@@", registration.FullName) : null;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a registration system that uses AJAX to process the form so
I am wondering how to do the following... I have a registration system. When
I have a product registration form that allows the user to add additional product
I have a PHP registration that calls a mysql db for a dropdown box.
I’m doing a patient registration system to a hospital, here we have 1st time
I am making a registration system with an e-mail verifier. Your typical use this
I have created a system that automatically registers function objects (functors) into a map
I have simple registration form. Once all information entered, user click submit button and
I have the convenient object factory template that creates objects by their type id
I have the following content types: Camp - the top level type Registration Information

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.