Results 1 to 3 of 3

Thread: FormsAuthentication question

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    FormsAuthentication question

    I'm using FormsAuthentication.RedirectFromLoginPage() and I dont have a default.aspx page for my application. So if I open a new browser window and go to the login page, it tries to go to the default page and I get an error. Is there any way to define a default page for the redirection?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    You can check if returnURL parameter exists and if it doesn't set an authentication ticket and redirect to a page of your choosing instead.
    VB Code:
    1. If Request.Params("ReturnURL") Is Nothing Then
    2.             FormsAuthentication.SetAuthCookie(strUsername, False)
    3.             Response.Redirect("Main.aspx")
    4.         Else
    5.             FormsAuthentication.RedirectFromLoginPage(strUsername, False)
    6.         End If

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by Fishcake
    You can check if returnURL parameter exists and if it doesn't set an authentication ticket and redirect to a page of your choosing instead.
    VB Code:
    1. If Request.Params("ReturnURL") Is Nothing Then
    2.             FormsAuthentication.SetAuthCookie(strUsername, False)
    3.             Response.Redirect("Main.aspx")
    4.         Else
    5.             FormsAuthentication.RedirectFromLoginPage(strUsername, False)
    6.         End If
    Thank you!
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width