I am making a job board for the college I attend.
When an employer first creates their account I need to have them fill in their profile as the first thing they do. Creating a profile gives them an Employer ID from the database. I need this in order to prevent them from creating a Job without first having an Employer ID which causes problems.
In order to do this I am disabling some links on the employer.master file based on the raw URL of the user. Disabling links is no problem except for the fact that I need to have one enabled, the "Contact us for help" link. If the new employer clicks this link, I need to check if they have already filled a profile and gotten their ID from the database (because this link is also available everywhere else in the site). If they have not, I need to maintain the disabled status of the links previously disabled.
My idea was to use code like the following which works fine on other pages in the site for determining who the user is.
After executing that code I would check to see if Session("Emp_UserLogin") has a value. If not, disable the links.
Session("Emp_UserLogin") = User.Identity.Name
Dim myConnectionString As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\CAC.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
Using myConnection As New SqlConnection(myConnectionString)
Dim myCommand As New SqlCommand()
myCommand.Connection = myConnection
myCommand.CommandText = "SELECT [EmpID] FROM [Employer] WHERE ([Emp_UserLogin] = '" & Session("Emp_UserLogin") & "')"
Session("EmpID") = myCommand.ExecuteScalar()