Re: Help!! RedirectFromLoginPage and GetRedirectUrl



try this


If User.Identity.IsAuthenticated Then
[do whatever here]
Else
response.redirect("~/login.aspx")
End If




"Sandy" <Sandy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C6FFCFB1-75EF-4BD0-8246-8E95BC550B68@xxxxxxxxxxxxxxxx
> Any help anyone can give me will be appreciated!!!! This is driving me
> c-r-a-z-y!
>
> All I can get from both of the above redirections is a redirect to a page
> named default.aspx. How do I make either of these work? I have an app
> that
> has two pages that need a login. I need to be able to have it
> automatically
> return to whichever page the user came from.
>
> I've tried both of the following (not together, of course):
> [Button Submit has code to check database]
> FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, False)
>
> [Button Submit has code to check database]
> Response.Redirect(FormsAuthentication.GetRedirectUrl(txtUserName.Text,
> False))
>
> My Web Config has this in it:
>
> <authentication mode="Forms" >
> <forms name=".LoginCookie" loginUrl="Login.aspx"
> protection="All" timeout="40" path="/" />
> </authentication>
> (Although I would rather not rely on cookies since people can turn them
> off,
> but I got this from an example in a book and couldn't find an example of
> how
> to do it without cookies.)
>
> I made sure in IIS the app was an app.
>
> I originally had one of the pages in a separate folder. I thought maybe
> that had something to do with it, so I cut and pasted it to the first
> level.
> That did nothing.
>
> Again, any suggestions will be greatly appreciated!
> --
> Sandy


.