Ask a Question related to ASP.NET Security, Design and Development.
-
WhiskyRomeo #1
redirecting from another page besides the login page
We have forms authentication working on a website. A user is presented the
login page where he can login or press a button to go to the Registration
page.
In the Registration page, he puts in his data and submits it. If
successful, he is taken to the login page to reenter is his username,
password. Can we elminate this second step without compromising security?
That is have the system login a user?
I attempted to redirect him from the Registration page, but forms
authentication will not allow that.
The code to do the redirections is very simple:
Private Sub RedirectUser(ByVal strUserName As String)
Dim strReturnURL As String = Request.QueryString.Item("ReturnUrl")
'create authentication ticket
Dim authTicket As New FormsAuthenticationTicket(1, strUserName,
DateTime.Now, DateTime.Now.AddMinutes(20), False, Session("WebRoles"))
'Create encrypted string representation of ticket
Dim strEncryptedTicket As String
Try
strEncryptedTicket = FormsAuthentication.Encrypt(authTicket)
Catch ex As Exception
Session("StringEncrptFailed") = ex.Message
End Try
'Store it within a HttpCookie Object
Dim authCookie As New
HttpCookie(FormsAuthentication.FormsCookieName, strEncryptedTicket)
Dim strCookiePath As String = authCookie.Path
'Add it the cookie to the outgoing cookie collection
Try
Response.Cookies.Add(authCookie)
Catch ex As Exception
Session("CookieAddFailed") = ex.Message
End Try
'Redirect the request
Response.Redirect(FormsAuthentication.GetRedirectU rl(strUserName,
True))
End Sub
--
wr
WhiskyRomeo Guest
-
making a login page which shud lead to a https page ?
(Type your message here) making a login page which shud lead to a https page ? ne suggestions -------------------------------- From: sneha... -
Learningsite not redirecting to login page
I hve seen the same problem...which will disappear after deactivating zonealarm! -
redirecting to a page
Hi every one, How can I redirect to a page after having checked that user was logged in correctly .... select id_user, user_login,... -
redirecting from .aspx page to .asp page
There is no great way to share session state between ASP and ASP.NET. But that doesn't mean you don't have options. Here are some common ways:... -
Redirecting to another page, after doing something
Hi After I have done some work on one of my php pages, I want to go to another page, and have that display, but I can't seem to work out how to... -
WhiskyRomeo #2
RE: redirecting from another page besides the login page
I think the answer to this problem is when the user sucessfully add himself
the following lines of code are executed:
FormsAuthentication.SetAuthCookie(tbEmail.Text, False)
Response.Redirect("Public/Appt.aspx")
I just want to make sure no compromise is made in security. Is there?
"WhiskyRomeo" wrote:
> We have forms authentication working on a website. A user is presented the
> login page where he can login or press a button to go to the Registration
> page.
>
> In the Registration page, he puts in his data and submits it. If
> successful, he is taken to the login page to reenter is his username,
> password. Can we elminate this second step without compromising security?
> That is have the system login a user?
>
> I attempted to redirect him from the Registration page, but forms
> authentication will not allow that.
>
> The code to do the redirections is very simple:
>
> Private Sub RedirectUser(ByVal strUserName As String)
>
> Dim strReturnURL As String = Request.QueryString.Item("ReturnUrl")
> 'create authentication ticket
> Dim authTicket As New FormsAuthenticationTicket(1, strUserName,
> DateTime.Now, DateTime.Now.AddMinutes(20), False, Session("WebRoles"))
>
> 'Create encrypted string representation of ticket
> Dim strEncryptedTicket As String
> Try
> strEncryptedTicket = FormsAuthentication.Encrypt(authTicket)
> Catch ex As Exception
> Session("StringEncrptFailed") = ex.Message
> End Try
>
> 'Store it within a HttpCookie Object
> Dim authCookie As New
> HttpCookie(FormsAuthentication.FormsCookieName, strEncryptedTicket)
> Dim strCookiePath As String = authCookie.Path
> 'Add it the cookie to the outgoing cookie collection
> Try
> Response.Cookies.Add(authCookie)
> Catch ex As Exception
> Session("CookieAddFailed") = ex.Message
> End Try
>
> 'Redirect the request
> Response.Redirect(FormsAuthentication.GetRedirectU rl(strUserName,
> True))
>
>
> End Sub
> --
> wrWhiskyRomeo Guest



Reply With Quote

