locked
Forms Authentication is not working RRS feed

  • Question

  • User1997074450 posted
    If String.IsNullOrEmpty(Request.Cookies("userInfo").Value) Then
                    Response.Redirect("../Login.aspx")
                Else
                    Response.Redirect("/Admin/BuyersList.aspx?userid=" & Request.Cookies("userInfo").Value)
                End If

    At line 1 it errors and says Object reference not set to an instance of an object.

    Saturday, January 30, 2021 10:00 PM

Answers

  • User-1545767719 posted

    Confirm if Request.Cookies("userInfo") is null.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, January 30, 2021 11:59 PM

All replies

  • User-1545767719 posted

    it is probably because the request header does not include the cookie named "userInfo". Please confirm.

    Saturday, January 30, 2021 10:23 PM
  • User1997074450 posted

    NO - How do I do that?

    This is my Page_Load

    Saturday, January 30, 2021 11:27 PM
  • User-1545767719 posted

    Confirm if Request.Cookies("userInfo") is null.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, January 30, 2021 11:59 PM
  • User1997074450 posted

    Ok, it makes sense now. It is null. I was using the wrong password and it was null. 

    I placed this code inside of login_click event and updated it. Now is working.

    Sunday, January 31, 2021 12:10 AM