Re: redirect not working
anonymous_at_discussions.microsoft.com
Date: 10/06/04
- Previous message: Daniel Fisher\(lennybacon\): "Re: redirect not working"
- In reply to: Daniel Fisher\(lennybacon\): "Re: redirect not working"
- Next in thread: Daniel Fisher\(lennybacon\): "Re: redirect not working"
- Reply: Daniel Fisher\(lennybacon\): "Re: redirect not working"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 6 Oct 2004 08:49:55 -0700
That line detects whether the user has come to the login
page from the homepage(index.aspx) and if so re-directs
(doesn't work) them to the index.aspx (I changed it to a
http:// address in the hope it would work as originally
it was /appliedbioscience/... type URL).
The idea behind this is that the user can login and get
access to the restricted-access documents by logging in
from the homepage. Otherwise they are taken to the login
page when they try to access some restricted content and
are redirected back to the page where they tried to
download the content from.
Hope this makes sense.
Thanks in advance for any pointers you may be able to
give.
Matt
>-----Original Message-----
>What do you want to do with this line?
>
>if(FormsAuthentication.GetRedirectUrl
>(txtUserName.Text,false)
=="/appliedbioscience/index.aspx")
>
>
>
>--
>Daniel Fisher(lennybacon)
> MCP C# ASP.NET
>Blog: http://www.lennybacon.com/
>
>"Matt Owens" <anonymous@discussions.microsoft.com> wrote
in message
>news:422201c4abae$0f994a60$a301280a@phx.gbl...
>>I have a login page which does not redirect the user
once
>> the code has been executed, see below. Whats strange is
>> it works perfectly on my localhost when debugging,
>> however it fails to redirect when depolyed to a remote
>> server. Am I missing any IIS settings or anything? The
>> login page just reloads once the login button has been
>> clicked.
>>
>> Code for the login button:
>>
>> private void _btnLogin_Click(object sender,
>> System.Web.UI.ImageClickEventArgs e)
>> {
>> if (IsValidUser(txtUserName.Text,
>> txtPassword.Text)) //interacts with the database. This
>> method is fine
>> {
>> if(FormsAuthentication.GetRedirectUrl
>> (txtUserName.Text,false)
=="/appliedbioscience/index.aspx")
>> {
>> FormsAuthentication.SetAuthCookie
>> (txtUserName.Text,false);
>> Response.Redirect
>>
("http://www.appliedbioscience.co.uk/appliedbioscience/ind
>> ex.aspx",false); //fails here
>> }
>> else if
>> ((FormsAuthentication.GetRedirectUrl
>> (txtUserName.Text,false).ToUpper().IndexOf("ADMIN") !
= -
>> 1) && (string)Session["Role"]!="admin")
>> phMsg.Controls.Add(new
>> LiteralControl("<font color=red>ERROR: You do not have
>> the necessary privellages to administrate this
>> site</font>"));
>> else
>>
>> FormsAuthentication.RedirectFromLoginPage
>> (txtUserName.Text,false); //fails here too
>> }
>> else
>> {
>> phMsg.Controls.Add(new LiteralControl
>> ("<font color=red>ERROR: Invalid Username /
>> Password</font>"));
>> }
>> }
>>
>> Thanks,
>> Matt
>>
>>
>
>
>.
>
- Previous message: Daniel Fisher\(lennybacon\): "Re: redirect not working"
- In reply to: Daniel Fisher\(lennybacon\): "Re: redirect not working"
- Next in thread: Daniel Fisher\(lennybacon\): "Re: redirect not working"
- Reply: Daniel Fisher\(lennybacon\): "Re: redirect not working"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|