troubleshooting Question

Properties vb.net

Avatar of vraag
vraag asked on
.NET ProgrammingEditors IDEs
11 Comments1 Solution326 ViewsLast Modified:
Hello,

I did convert a piece of C# source to VB.net
public class properties
{
    private static HttpContext Context { get { return System.Web.HttpContext.Current; } }
    private static HttpSessionState Session { get { return Context.Session; } }

    // Get settings from session
    public static string loggedIn { get { return (Session["Properties.loggedIn"] ?? String.Empty).ToString(); } set { Session["Properties.loggedIn"] = value; } }
    public static string userId { get { return (Session["Properties.userId"] ?? String.Empty).ToString(); } set { Session["Properties.userId"] = value; } }
}

Open in new window


to:
Public Class properties
    Private Shared ReadOnly Property Context() As HttpContext
        Get
            Return System.Web.HttpContext.Current
        End Get
    End Property
    Private Shared ReadOnly Property Session() As HttpSessionState
        Get
            Return Context.Session
        End Get
    End Property

    ' Get settings from session
    Public Shared Property loggedIn() As String
        Get
            Return (If(Session("Properties.loggedIn"), String.Empty)).ToString()
        End Get
        Set(ByVal value As String)
            Session("Properties.loggedIn") = value
        End Set
    End Property
    Public Shared Property userId() As String
        Get
            Return (If(Session("Properties.userId"), String.Empty)).ToString()
        End Get
        Set(ByVal value As String)
            Session("Properties.userId") = value
        End Set
    End Property


End Class

Open in new window


If i run this i get the following error:
Compilation error

Error message from compiler: BC30201: Expressie expected.

Error in source:

 

Regel 25:     Public Shared Property loggedIn() As String
Regel 26:         Get
Regel 27:             Return (If(Session("Properties.loggedIn"), String.Empty)).ToString()
Regel 28:         End Get
Regel 29:         Set(ByVal value As String)
 

Does any one know what goes wrong?

Thanks in advance.
ASKER CERTIFIED SOLUTION
vraag

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros