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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:23:55+00:00 2026-05-11T06:23:55+00:00

I am having some trouble with one of my ASP.NET 2.0 application’s connection string.

  • 0

I am having some trouble with one of my ASP.NET 2.0 application’s connection string. There are instances that I would get a ConnectionString Property Has not Been Initialized problem which occurs randomly and intermittently and without any reason.

My Connection string is actually coming from a webservice, because different kinds of users are provided with different sets of connection string depending on their user level.

What I have done so far goes like this:

I have a master page (mstr.page) and the corresponding code behind (mstr.page.vb).

In my master page, I retrieve initially the connection string and store the same into a session variable, i.e.

Session('ConnString') = 'RetrievedConnectionString' 

Now in one of my pages, let us say page1.aspx.vb, I use public shared functions from a class (named MyClass.vb) and use it in my page1.aspx.vb.

Some codes for reference:

[MyClass.vb] Imports System.Web  NameSpace ClassNameSpace   Public Class Admin     Protected Shared da as New DataAccess()      Public Shared Function MYFunction() as String       'Execute some sql statements here, using the DataAccess       stringToReturn = Ctype(da.ExecuteScalar('SQLCommand'), String)       Return stringToReturn     End Function   End Class End NameSpace  [DataAccessClass.vb] Public Class DataAccess()   Private m_ConStr As String = ''    Public Sub New()     m_ConStr = HttpContext.Current.Session('ConnString')   End Sub    'Some methods for SQL statement execution (ExecuteQuery, ExecuteScalar) End Class  [Page1.aspx.vb] Imports ClassNameSpace  Protected Sub Page_Load(....) Handles Me.Load   Dim strValue as String = Admin.MyFunction() End Sub 

I have placed the code above to show you some rough idea of how things are going.

Basically, the function Admin.MyFunction() at times fails, because in the data access class, the connection string seems to have lost it’s value (either blank or Nothing).

This has troubled me for quite some time already.

I hope someone can point me in the right direction to resolve this. Basically, I want my connection string which is retrieved by each user visiting the web application be maintained across all the time and be used anywhere. Session variable does not seem to be the best fit since when the ASP.NET recycles its process, the session is lost.

By the way, I am retrieving the connectionstring initially via the master page from a web service. I tried to place the same retrieve function in the Data Access class when conditions is that the session variable is lost, but I think my application cannot connect to the Web Service during the recycle process.

Any advice would be greatly appreciated on this.

Update on this:

I tried to use Session Variable and set the mode to State Server, but apparently some DLLs which I am using cannot be serialized, thus I am back to square one.

Is there a better way to do this?

  • 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. 2026-05-11T06:23:56+00:00Added an answer on May 11, 2026 at 6:23 am

    One thing to check is if your Session is getting clobbered. If your using the (default) in-memory Session, then sessions die anytime an ASP.NET worker process is recycled. If this is causing your issue, you might have to look into using the ASP.NET SessionServer in IIS, or SQL Server as your Session storage.

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

Sidebar

Related Questions

i'm having some trouble. I'm doing an asp.net mvc3 application and i downloaded some
I am having some trouble with an ASP.NET website I've set up and it's
I'm building my first ASP.NET MVC application and I am having some troubles with
im having some trouble with the radio button list in ASP.net, for some reason
I am making my first website with ASP.net and am having some trouble with
I am having some trouble getting a List of one of my classes that
I'm having some trouble with getting this SQL right. There is a one-to-many relationship
I am having some trouble figuring out why I am only receiving one reply
I'm having trouble with some Excel data validation. On one sheet, I have a
I´m having some trouble retrieving a collection of strings in a projection: say that

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.