---
title: "FormsAuthentication"
type: "forum-thread"
url: "https://www.webforum.nu/amne/dotnet/61839-formsauthentication"
topic: ".NET"
topic_url: "https://www.webforum.nu/amne/dotnet"
author: "andreas_lindh"
published: "2002-12-10T21:17:48.000Z"
updated: "2002-12-10T21:20:45.000Z"
replies: 1
views: 147
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/dotnet/61839-formsauthentication"
---

# FormsAuthentication

## #1 — andreas_lindh, 2002-12-10T21:17Z

har en inloggning som ser ut så här

```
Public Sub login(ByVal obj As Object, ByVal e As EventArgs)
        Dim objcmd As New OleDbCommand _
                      ("SELECT * from users where Username='" + tbusername.Text + "' and password='" + tbPassword.Text + "'", objconn)

        Dim dr As OleDbDataReader

        objconn.Open()
        dr = objcmd.ExecuteReader

        If dr.Read Then
            Session("user") = dr("Username")
            Session("klubbid") = dr("id")
            FormsAuthentication.SetAuthCookie(dr("username"), False)
            Response.Redirect("inloggad.aspx")

        Else

            label.Text = "Felaktigt användarnamn eller lösenord<br />"
        End If
        objconn.Close()

    End Sub
```

Har nu gjort om det till codebehind och undrar vad jag ska sätta FormsAuthentication som
Public FormsAuthentication as ?

Permalänk: https://www.webforum.nu/p/61839

## #2 — andreas_lindh, 2002-12-10T21:20Z

hittade det. Behövde importera System.Web.Security

Permalänk: https://www.webforum.nu/p/883395

---

Tråden på webben: https://www.webforum.nu/amne/dotnet/61839-formsauthentication
