473,668 Members | 2,542 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Redirect a person to a particular page after authentication

I am using the code below to check whether a member is valid or not ,
and if he is then allowing him to certain parts of the site. My problem
is when a person logs on by entering his user ID and pwd he'll always
be directed to the index.aspx page.if he clicks APPLY JOB button it
should first ask for login details and then i want him to get directed
to the respective page (applyjob.aspx) not the index.aspx. I cant do
Response.Redire ct then it will directly all my pages to the
applyjob.aspx. I hope i made some sense till now. Can anyone help me in
this pleas
Thanks in Advance
private void btnlogin_Click( object sender, System.EventArg s e)
{
bool blnAuthenticati on =
Authenticate(tx tusername.Text, txtpassword.Tex t);
if(blnAuthentic ation)
{
FormsAuthentica tion.RedirectFr omLoginPage(txt username.Text,f alse);
Session["isMemberLogged In"]= true;
Response.Redire ct("index.aspx" );
}
else
{
Session["isMemberLogged In"]= false;
lblErr.Text = "Your Login was invalid. Please try again.";
txtusername.Tex t="";
}
}

Nov 20 '05 #1
2 1416

I think you should remove:
FormsAuthentica tion.RedirectFr omLoginPage(txt username.Text,f alse);
"savvy" <jo******@gmail .com> schreef in bericht
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
I am using the code below to check whether a member is valid or not ,
and if he is then allowing him to certain parts of the site. My problem
is when a person logs on by entering his user ID and pwd he'll always
be directed to the index.aspx page.if he clicks APPLY JOB button it
should first ask for login details and then i want him to get directed
to the respective page (applyjob.aspx) not the index.aspx. I cant do
Response.Redire ct then it will directly all my pages to the
applyjob.aspx. I hope i made some sense till now. Can anyone help me in
this pleas
Thanks in Advance
private void btnlogin_Click( object sender, System.EventArg s e)
{
bool blnAuthenticati on =
Authenticate(tx tusername.Text, txtpassword.Tex t);
if(blnAuthentic ation)
{
FormsAuthentica tion.RedirectFr omLoginPage(txt username.Text,f alse);
Session["isMemberLogged In"]= true;
Response.Redire ct("index.aspx" );
}
else
{
Session["isMemberLogged In"]= false;
lblErr.Text = "Your Login was invalid. Please try again.";
txtusername.Tex t="";
}
}

Nov 20 '05 #2
Partially.

redirectFromLog in page does 2 things
(a) sets the authentication cookie
(b) redirects

You want to remove the call to RedirectFromLog inPage

but you must replace it with FormsAuthentica tion.SetAuthCoo kie and then you
can redirect as your example does.

Karl

P.S. - why use a session to track if the user is logged in if you are using
forms authentication?
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Edwin Knoppert" <ne**@hellobasi c.com> wrote in message
news:43******** **************@ text.nova.plane t.nl...

I think you should remove:
FormsAuthentica tion.RedirectFr omLoginPage(txt username.Text,f alse);
"savvy" <jo******@gmail .com> schreef in bericht
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
I am using the code below to check whether a member is valid or not ,
and if he is then allowing him to certain parts of the site. My problem
is when a person logs on by entering his user ID and pwd he'll always
be directed to the index.aspx page.if he clicks APPLY JOB button it
should first ask for login details and then i want him to get directed
to the respective page (applyjob.aspx) not the index.aspx. I cant do
Response.Redire ct then it will directly all my pages to the
applyjob.aspx. I hope i made some sense till now. Can anyone help me in
this pleas
Thanks in Advance
private void btnlogin_Click( object sender, System.EventArg s e)
{
bool blnAuthenticati on =
Authenticate(tx tusername.Text, txtpassword.Tex t);
if(blnAuthentic ation)
{
FormsAuthentica tion.RedirectFr omLoginPage(txt username.Text,f alse);
Session["isMemberLogged In"]= true;
Response.Redire ct("index.aspx" );
}
else
{
Session["isMemberLogged In"]= false;
lblErr.Text = "Your Login was invalid. Please try again.";
txtusername.Tex t="";
}
}


Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1936
by: Donald Williamson | last post by:
Hi Hope someone can help me with authentication and how the redirects work. I' ve already tried searching previous posts but didn't really find anything. for I have a page that checks to see if the user has logged in. If not, it redirects them to the login page for authentication. After authenticating, I want to redirect them back to the original page that sent them. I always get redirected back to the default page. I noticed that...
4
4826
by: Dave | last post by:
Hi, Is there anyway to mimic forms authentication's loginUrl and RedirectFromLoginPage functionality using Windows authentication? We are developing intranet sites using basic authentication and we want to always redirect a user to a default 'splash' or welcome page that is set to anonymous if they are not logged in. This page would have
0
1194
by: Ed Henn | last post by:
I'm having a problem with .NET Forms Authentication in a particular application. It's not redirecting properly when my session is timed out, seemingly only when I POST the page (i.e. click a form submit button). If I try to GET a page after timeout (i.e. just picking a page to visit from a menu), I am redirected to the login screen properly. The browser error I'm getting in the POST example is "403.1 Execute Access Forbidden". I...
3
7866
by: Peter Row | last post by:
Hi, I better get the background stuff out the way first, so here goes: - Porting a VB6 webclass app to VB.NET using HttpHandlers and FormsAuthentication - When someone visits my site unbeknown to them they are automatically logged in as a guest via the .NET forms authentication.
1
778
by: Ather Ali Shaikh | last post by:
Hello I am using Forms Authentication. but the page is not redirect to desired login page after session is expired. When I debug the application. Session_end is called. In the Session_End method I write code to redirect to the LoginPage as (response.redirect("Login.aspx") or server.transfer("Login.aspx")). But it is not redirecting. It runs the redirecting code but physically not redirect. What should I do more.?
1
1807
by: Grey | last post by:
I have set the following parameters in web.config to prevent user direct access the web page without user login. <authentication mode="Forms"> <forms loginUrl="Initial/index.aspx" name="adAuthCookie" timeout="60" path="/" > </forms> </authentication> The application did success to redirect to login page, but it cannot redirect back to desire page which I specify in URL. What's wrong with my
1
2697
by: Sospeter | last post by:
Hi Ken, I have done that but still experiencing same problem. Tried the following i.e. turning smartnavigation = false and using server.transfer as below but nothing works. Please help. Page.SmartNavigation = False FormsAuthentication.SetAuthCookie(txtCustID.Text, False)
5
4562
by: venner | last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET 2.0. The website makes use of a central authentication service (CAS) provided at the university I work for. Each page checks a session variable, and if it is not present, does a Response.Redirect to a webpage for the CAS passing a url parameter for the url to post back to. The CAS provides a page for the user to log into, validates the username and password, and then...
1
2572
by: rouellette | last post by:
Is it possible to redirect to another page in your application from the start page BEFORE the user has been authenticated if you're using FORMS authentication? I can't seem to get it to work. Simple example: In your start page simply try to redirect... private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) // or is. doesn't matter. { Response.Redirect(APageInYourApplication.aspx); }
0
8371
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8572
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8652
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2782
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.