Solved

asp.net connection string value lost

Posted on 2007-12-03
7
163 Views
Last Modified: 2013-11-07
I setup my connection string in my web.config.

I have a custom membership provider that defines it in the initialize....
connStr = config("connectionString")

When I call the validateuser(), it hits the connection string okay.

I call the exact same code in my GetUser(), and now my connection string is empty.

both have these at the top:
        Using conn As New SqlConnection(connStr)

What is happening? Why is it now empty for this function?
thanks.
0
Comment
Question by:Starr Duskk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
7 Comments
 
LVL 15

Accepted Solution

by:
spprivate earned 500 total points
ID: 20398618
connStr = config("connectionString")
I assume this connstr variable scope is not public or class level.You would have declared it in a method level and hence you are not getting the value.
Declare the connStr initialization on a class level and then use it.
0
 
LVL 2

Author Comment

by:Starr Duskk
ID: 20398755
It IS class level:

Public Class CustomMembershipProvider
    Inherits MembershipProvider

    Private connStr As String
    Private comm As New SqlClient.SqlCommand
0
 
LVL 2

Author Comment

by:Starr Duskk
ID: 20398816
I declared it Public and that didn't fix it either.

I do notice stepping through it, that the Initialize is not called on the GetUser. It is called on the ValidateUser, but not the GetUser....

???
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 2

Author Comment

by:Starr Duskk
ID: 20398842
I take that back. When I log in, it hits the validateuser, but putting a breakpoint on the initialize, I never see it hit that.

Although, the ValidateUser does have a valid connstr.
0
 
LVL 2

Author Comment

by:Starr Duskk
ID: 20398875
Hmmm. I have old backup copies that are hitting the initialize on log in when I debug, but my latest version is not.

What could be the reason?
thanks.
0
 
LVL 2

Author Comment

by:Starr Duskk
ID: 20398898
Okay, I notice that when I put code to call my getuser in my pre_init on my master page, it never hits the initialize. I'll have to look at that.

Meanwhile, if anyone has any thoughts, would appreciate it.

thanks.
0
 
LVL 2

Author Comment

by:Starr Duskk
ID: 20398987
I need to create a new question on this.

My problem is that my initialize is not firing. So I need to ask about that.

thanks.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question