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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:26:36+00:00 2026-05-20T08:26:36+00:00

As a followup to the previous question I have asked ASP.Net Architecture Specific to

  • 0

As a followup to the previous question I have asked “ASP.Net Architecture Specific to Shared/Static functions”

I am still struggling to understand the implications of using shared methods in ASP.NET.

So for example let us take the following code.

    Public Shared Function GetCategoryByID(ByVal CategoryID As Guid) As Category
        If Not CategoryID.Equals(Guid.Empty) Then
            Dim res As New Category

            Using sqlConn As New SqlConnection(My.Settings.ConnectionString)
                sqlConn.Open()

                Using dr As IDataReader = CategoryDataLayer.GetCategoryByIDQuery(sqlConn, CategoryID)
                    Return CType(BaseDataLayer.FillObject(res, dr), Category)
                End Using
            End Using

        Else
            Return Nothing
        End If
    End Function

Now I imagine client 1 connecting and running this method GetCategoryByID() from their session with the guid {A20E625F-2333-4742-BFD9-05BE7649222D}.

Let us now say that for example the process is about to execute the following line.

Using dr As IDataReader = CategoryDataLayer.GetCategoryByIDQuery(sqlConn, CategoryID)

At this point client 2 runs the same shared method but with the guid {6D806B82-FC7F-4124-AFB9-45E2689BC9F5}.

Does CategoryID not at this point become {6D806B82-FC7F-4124-AFB9-45E2689BC9F5} and therefor interfere with client 1 because now CategoryID has changed given that this is a shared method?

Could someone please clarify?

PS: I do apologize for what is essentially a duplicate post but in retrospect I don’t feel the answer in the original post was clear enough (at least for me). Perhaps I wasn’t specific enough either…

  • 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-20T08:26:36+00:00Added an answer on May 20, 2026 at 8:26 am

    In your code sample, the variable res is a local variable of the shared method. No one, not even another shared method can touch that variable. It will exist for the lifetime of the method and then its gone. CategoryId is the exact same, its a local variable that cannot be touched from outside.

    VB has another concept called Static which is very different than the C# version of static which can cause some confusion.

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

Sidebar

Related Questions

This is a followup on the question: ASP.NET next/previous buttons to display single row
As a followup to my previous question about determining camera parameters I have formulated
Hey guys this is a followup to my previous question . I now have
I have a followup problem to my previous question. I have got the list
This is kind of a followup on my previous question . I have an
This is a follow up from my previous question I have this code basically
In a follow-up to a previous question, let's say I have 3 tables, A,
This is a followup of a previous question I had. I got the very
Greetings, As a followup to my previous question about Moose, I've now run into
That is a followup from my previous question , but you don't need to

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.