---
title: "authentication problem"
type: "forum-thread"
url: "https://www.webforum.nu/amne/dotnet/103345-authentication-problem"
topic: ".NET"
topic_url: "https://www.webforum.nu/amne/dotnet"
author: "Arne"
published: "2004-05-11T06:43:08.000Z"
updated: "2004-05-11T06:43:08.000Z"
replies: 0
views: 213
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/103345-authentication-problem"
---

# authentication problem

## #1 — Arne, 2004-05-11T06:43Z

Då var det problem igen med min inloggning. Kan någon förbarma sig och hjälpa mig;-)

Inloggningen fungerar nu utmärkt förutom när jag använder "Kom ihåg mig!".

Bockar jag i den får jag värdet True på den den sida jag ska hamna på (GetRedirectUrl)
Bockar jag inte i den får jag False, så det verkar fungera.

Men om jag bockar i "Kom ihåg mig!" så ska jag väl inte behöva logga in mig igen? Jag hamnar obenhörligen till min inloggningsida än om jag bockar i "Kom ihåg mig!" eller inte.

Nedan min kod och web.config

Snälla hjälp mig någon......

Min Web.Config

```
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  
<system.web>

	<customErrors mode="Off"/>		

	<globalization fileEncoding="iso-8859-1" requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" culture="sv-SE" uiCulture="sv-SE" />

	<authentication mode="Forms">
		<forms loginUrl="minsida/login/default.aspx"/>
	</authentication>
	
	<authorization>
		<allow users="*" />
	</authorization>

</system.web>

<location path="minsida">

	<system.web>
		<authorization>
			<deny users="?" /> 
		</authorization>
	</system.web>
</location>

</configuration>
```

```
Private Sub LoginBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

Dim medlem As String = user.Text
Dim isPersistent As Boolean = remember.Checked

MyCommand = New SqlCommand("Min selectsats....", MyConnection)

Dim myreader As SqlDataReader = mycommand.ExecuteReader

If myreader.Read Then
	
Dim userData As Integer = myreader("id")
Dim ticket As New FormsAuthenticationTicket( 1, medlem, System.DateTime.Now, System.DateTime.Now.AddMinutes(12), isPersistent, userData, FormsAuthentication.FormsCookiePath)

Dim encTicket As String = FormsAuthentication.Encrypt(ticket)

Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket))

Response.Redirect(FormsAuthentication.GetRedirectUrl(medlem,isPersistent))

Else 
lblMessage.Text = "ERROR"
End If
        
End Sub
```

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

---

Tråden på webben: https://www.webforum.nu/amne/dotnet/103345-authentication-problem
