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 363637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:21:42+00:00 2026-05-12T13:21:42+00:00

I have to send emails when a person receives a personal message on my

  • 0

I have to send emails when a person receives a personal message on my website and for that I use a StringBuilder to create the HTML markup of the email.

also since it is required at many other places as well I have made a Shared Function (I am using VB.NET). now my only concern is that since shared functions are shared among all objects and maybe asp.net sessions, can it be possible that before one person email is being formed and another person access the same function, it would cause the data in the stringbuilder to be overwritten..

Currently my site doesn’t have many users but can this become an issue in the future… Please advise me on this… Is there any better way or standard procedure to follow when using shared functions?

Also at one time I made the mistake of using a shared connection object and it would cause close if many people were to access it.

  • 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-12T13:21:42+00:00Added an answer on May 12, 2026 at 1:21 pm

    Shared functions can only access static/global variables as well as variable inside the function scope. So, if the the function is working with any number of static/shared resources then you need to synchronize between the calls to the function.

    In your case, however, it doesn’t sound like you’re working with any shared resources, so it shouldn’t be a problem.

    Here’s a case that illustrates the problem:

     private static myCounter As Integer = 0
    
     public shared function IncreaseCount() As Integer
        myCounter += 1
    
        for i as integer = 0 to 10 million
          //'do extensive work
        next
    
        return myCounter
     End Function
    

    Imagine that you call the function for the first time, and you would expect it to return the number 1. But due to the fact that the function was called again before the first function call got to return the counter was increased once more, which means that both function calls return 2 instead of respectively 1 and 2. All the problem arrives when you want several things working on the same static resource.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website that receives incoming emails via cloudmailin, adds the content to
i have an application that uses SMTP to send emails from an yahoo account.
I have a function that uses CDO to send emails with request to have
I have a few scripts that send out emails to my users, and for
I have a website and I need to send personalized emails to registered members.
I have used default mail() function to send email it sends emails to yahoo
i want to have my dnn portal send me and another person an email
I have an application where I can send emails. Now am asked to use
I have a target in my build script that will send an email with
We have been using ICS , THtmlSmtpCli to send emails from our applications for

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.