Ask a Question related to ASP.NET Security, Design and Development.
-
Paul Glavich [MVP - ASP.NET] #1
Re: Response.ReDirect / FormsAuth.ForwardFromLogin not working
Instead of doing :-
FormsAuthentication.SetAuthCookie
(txtUserName.Text,false);
Response.Redirect
("http://www.appliedbioscience.co.uk/appliedbioscience/ind
ex.aspx",false); //fails here
try doing :-
FormsAuthentication.RedirectFromLoginPage(txtUserN ame.Text,false);
and see what happens.
--
- Paul Glavich
Microsoft MVP - ASP.NET
"Matthew Owens via .NET 247" <anonymous@dotnet247.com> wrote in message
news:eFn57HDtEHA.1468@TK2MSFTNGP12.phx.gbl...> Hi,
>
> 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 back to itself 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
>
> -----------------------
> Posted by a user from .NET 247 ([url]http://www.dotnet247.com/[/url])
>
> <Id>2lDQndDYrkKxWzYTDB1qwA==</Id>
Paul Glavich [MVP - ASP.NET] Guest
-
response.redirect to an HTTPS not working
I have a web from that based on the user's response needs to go to a web folder set up with SSL. My problem is that when the redirect is executed I... -
Response.Flush / Response.Redirect
Hi, I've had a good google and can't find anything already on this so : I'm currently trying to have a 'Page Loading' page on a site. The way... -
Response.redirect only working sometimes
I have response.redirect("/home.asp") in my code but instead of redirecting to that page it sometimes redirects to the current page... -
Response.Write and Response.Redirect
On my Page_Load event, i need to do some validation and then either let them proceed, or display a error message and boot them back to the previous... -
Redirect to New Browser Window like Response.Redirect
That worked just fine for me as long as you put that open statement on one line rather than 2. "michel" <michely3k@yahoo.com> wrote in... -
Patrick.O.Ige #2
RE: Response.ReDirect / FormsAuth.ForwardFromLogin not working
Hi Mathew,
Try using another forms of Redirection!
maybe response.redirect!
Enjoy!
Patrick
"Matthew Owens via .NET 247" wrote:
> Hi,
>
> 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 back to itself 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
>
> -----------------------
> Posted by a user from .NET 247 ([url]http://www.dotnet247.com/[/url])
>
> <Id>OefijW+jmUCo6aXadH2FPg==</Id>
>Patrick.O.Ige Guest



Reply With Quote

