- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsWhen I try to use a value stored in the Profile in a public class I receive the following error message.
?currentProfile.DBServerIP
A first chance exception of type 'System.Configuration.Sett
Previously I asked how to access the Profile values in a public class. It was answered. That solution had me add.
Dim currentProfile as new ProfileCommon to each of the subroutines in the public class.
It is working. There is a subroutine which assigns the values to all of the properties in my Profile. This works fine.
It is later after opening several other pages that the problem occurs. When the page Load event fires the Profile.DBServerIP15String
What am I doing wrong?
The Profile variables are defined in the web.config and stored in Sql 2005.
Page Load event
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
'AT THIS POINT PROFILE.DBSERVERIP15STRING
LogInCtl.PopulateStateDrop
DataCtl.PopulateCountryCod
LoadAdminInfo()
Else
End If
End Sub
The subroutine in the Public Class LOGINCTL
Public Shared Sub PopulateStateDropDownList(
Dim AdminConnSqlConnection As New System.Data.SqlClient.SqlC
Dim Dr1SqlDataReader As System.Data.SqlClient.SqlD
Dim Dr1SqlCommand As New System.Data.SqlClient.SqlC
Dim Parmstring As String
Dim strStateCode As String
Dim strStateName As String
Dim currentProfile As New ProfileCommon
'AT THIS POINT currentProfile.DBServerIP1
Parmstring = "Server=" & currentProfile.DBServerIP1
"; Database=Admin01; User ID=" & currentProfile.DBUserName1
end sub
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: mpdillonPosted on 2008-05-08 at 06:26:21ID: 21524404
After the Dim statement add
Profile, ProfileCommon)
Dim currentProfile As New ProfileCommon
currentProfile = CType(HttpContext.Current.