Jason Weber
Jason Weber

Reputation: 5741

Why is VIsual Studio saying this code behind for my homepage.master.vb is missing an end tag?

Visual Studio says this line is missing an end tag, but I've googled and googled, and cannot figure out what to put there. This is my code behind for my homepage.master.vb:

Imports Udev.MasterPageWithLocalization.Classes

Partial Public Class Homepage

Inherits System.Web.UI.MasterPage

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Init
    If Session([Global].SESSION_KEY_CULTURE) Is Nothing OrElse _
        Me.Request.QueryString("lang") <> Session([Global].(SESSION_KEY_CULTURE) Then
        RequestLanguageChange(Me.Request.QueryString("lang"))
    End If
End Sub

Protected Sub RequestLanguageChange(ByVal culture As String)
    'store requested language as new culture in the session
    Session([Global].SESSION_KEY_CULTURE) = culture

    'reload last requested page with new culture
    Server.Transfer(Request.Path)
   End Sub
 End Class

The line that says:

   Me.Request.QueryString("lang") <> Session([Global].(SESSION_KEY_CULTURE) Then

Is the line that's giving me all the trouble. It's saying that an end tag is missing, or something. Consequently, it's not working in conjunction with my classes -- BasePage.vb, Culture.vb, and Global.vb, and the page won't display. The page is intended to give me URLs like clients.aspx?lang=FR.

Upvotes: 1

Views: 171

Answers (2)

Rahul Soni
Rahul Soni

Reputation: 4968

There should be no gap in the lines below...

 If Session([Global].SESSION_KEY_CULTURE) Is Nothing OrElse _
        Me.Request.QueryString("lang") <> Session([Global].(SESSION_KEY_CULTURE) Then

Seems like you have one...

 If Session([Global].SESSION_KEY_CULTURE) Is Nothing OrElse _
        Me.Request.QueryString("lang") <> Session([Global].(SESSION_KEY_CULTURE) Then

Upvotes: 0

John Saunders
John Saunders

Reputation: 161801

You have an extra parenthesis. Try Session([Global].SESSION_KEY_CULTURE) or Session([Global].(SESSION_KEY_CULTURE)).

Upvotes: 4

Related Questions