473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Log user in

Using forms authentication in C# I usually use
FormsAuthentication.RedirectFromLoginPage to log a user in as follows

FormsAuthentication.RedirectFromLoginPage(id,false );

How can I log a user in without re-directing them somewhere else? I simply
want to log the in and then run some other code without re-directing them.

I've tried .SetAuthCookie(id,false) but this doesn't seem to work.

Any ideas?
Nov 18 '05 #1
6 1326
SetAuthCookie will set an Auth cookie for the next request, i.e. cookie will
be sent with the response. This way you can't use User.Identity to get an
information about just logged in user without receiving a new request with
the new Auth cookie just set - you need to use your own mechanism.

"Andrew Banks" <ba****@nojunkblueyonder.co.uk> wrote in message
news:AC*********************@news-text.cableinet.net...
Using forms authentication in C# I usually use
FormsAuthentication.RedirectFromLoginPage to log a user in as follows

FormsAuthentication.RedirectFromLoginPage(id,false );

How can I log a user in without re-directing them somewhere else? I simply
want to log the in and then run some other code without re-directing them.

I've tried .SetAuthCookie(id,false) but this doesn't seem to work.

Any ideas?

Nov 18 '05 #2
SetAuthCookie will set an Auth cookie for the next request, i.e. cookie will
be sent with the response. This way you can't use User.Identity to get an
information about just logged in user without receiving a new request with
the new Auth cookie just set - you need to use your own mechanism.

"Andrew Banks" <ba****@nojunkblueyonder.co.uk> wrote in message
news:AC*********************@news-text.cableinet.net...
Using forms authentication in C# I usually use
FormsAuthentication.RedirectFromLoginPage to log a user in as follows

FormsAuthentication.RedirectFromLoginPage(id,false );

How can I log a user in without re-directing them somewhere else? I simply
want to log the in and then run some other code without re-directing them.

I've tried .SetAuthCookie(id,false) but this doesn't seem to work.

Any ideas?

Nov 18 '05 #3
Sorry Viktor, I don't fully understand what you are saying.

Can anyone give an example of how I can log a user in without using
RedirectFromLoginPage?

Thanks

"Viktor Jevdokimov" <vj*********@hotmail.com> wrote in message
news:OI**************@TK2MSFTNGP10.phx.gbl...
SetAuthCookie will set an Auth cookie for the next request, i.e. cookie will be sent with the response. This way you can't use User.Identity to get an
information about just logged in user without receiving a new request with
the new Auth cookie just set - you need to use your own mechanism.

"Andrew Banks" <ba****@nojunkblueyonder.co.uk> wrote in message
news:AC*********************@news-text.cableinet.net...
Using forms authentication in C# I usually use
FormsAuthentication.RedirectFromLoginPage to log a user in as follows

FormsAuthentication.RedirectFromLoginPage(id,false );

How can I log a user in without re-directing them somewhere else? I simply want to log the in and then run some other code without re-directing them.
I've tried .SetAuthCookie(id,false) but this doesn't seem to work.

Any ideas?


Nov 18 '05 #4
Sorry Viktor, I don't fully understand what you are saying.

Can anyone give an example of how I can log a user in without using
RedirectFromLoginPage?

Thanks

"Viktor Jevdokimov" <vj*********@hotmail.com> wrote in message
news:OI**************@TK2MSFTNGP10.phx.gbl...
SetAuthCookie will set an Auth cookie for the next request, i.e. cookie will be sent with the response. This way you can't use User.Identity to get an
information about just logged in user without receiving a new request with
the new Auth cookie just set - you need to use your own mechanism.

"Andrew Banks" <ba****@nojunkblueyonder.co.uk> wrote in message
news:AC*********************@news-text.cableinet.net...
Using forms authentication in C# I usually use
FormsAuthentication.RedirectFromLoginPage to log a user in as follows

FormsAuthentication.RedirectFromLoginPage(id,false );

How can I log a user in without re-directing them somewhere else? I simply want to log the in and then run some other code without re-directing them.
I've tried .SetAuthCookie(id,false) but this doesn't seem to work.

Any ideas?


Nov 18 '05 #5
OK, I have a login form with the login button. In the LoginButton_Click
event handler method I validate user name and password in the DB. If
validation is successfult, I have this line of code for example:
System.Web.Security.FormsAuthentication.SetAuthCoo kie(strUserName, False,
"/")

"/" is the cookie path.
Below this line I have the code I need, and finally, a redirect, since my
controls and pagest looking for a Page.User.Identity, which will be changed
ONLY with the next request, since current request was without authentication
cookie you just set with "SetAuthCookie". What else?

What I'm saying, you have to know, how your application performs a request
step by step, and is it possible to use a request context to put an
authentication info (user name, etc) on the context, and check it somewhere
in your application, instead of Page.User.Identity...

Finally, how can you determine, that "SetAuthCookie" is not working?
"Andrew Banks" <ba****@nojunkblueyonder.co.uk> wrote in message
news:Yi*********************@news-text.cableinet.net...
Sorry Viktor, I don't fully understand what you are saying.

Can anyone give an example of how I can log a user in without using
RedirectFromLoginPage?

Thanks

"Viktor Jevdokimov" <vj*********@hotmail.com> wrote in message
news:OI**************@TK2MSFTNGP10.phx.gbl...
SetAuthCookie will set an Auth cookie for the next request, i.e. cookie

will
be sent with the response. This way you can't use User.Identity to get an
information about just logged in user without receiving a new request with the new Auth cookie just set - you need to use your own mechanism.

"Andrew Banks" <ba****@nojunkblueyonder.co.uk> wrote in message
news:AC*********************@news-text.cableinet.net...
Using forms authentication in C# I usually use
FormsAuthentication.RedirectFromLoginPage to log a user in as follows

FormsAuthentication.RedirectFromLoginPage(id,false );

How can I log a user in without re-directing them somewhere else? I

simply want to log the in and then run some other code without re-directing them.
I've tried .SetAuthCookie(id,false) but this doesn't seem to work.

Any ideas?



Nov 18 '05 #6
OK, I have a login form with the login button. In the LoginButton_Click
event handler method I validate user name and password in the DB. If
validation is successfult, I have this line of code for example:
System.Web.Security.FormsAuthentication.SetAuthCoo kie(strUserName, False,
"/")

"/" is the cookie path.
Below this line I have the code I need, and finally, a redirect, since my
controls and pagest looking for a Page.User.Identity, which will be changed
ONLY with the next request, since current request was without authentication
cookie you just set with "SetAuthCookie". What else?

What I'm saying, you have to know, how your application performs a request
step by step, and is it possible to use a request context to put an
authentication info (user name, etc) on the context, and check it somewhere
in your application, instead of Page.User.Identity...

Finally, how can you determine, that "SetAuthCookie" is not working?
"Andrew Banks" <ba****@nojunkblueyonder.co.uk> wrote in message
news:Yi*********************@news-text.cableinet.net...
Sorry Viktor, I don't fully understand what you are saying.

Can anyone give an example of how I can log a user in without using
RedirectFromLoginPage?

Thanks

"Viktor Jevdokimov" <vj*********@hotmail.com> wrote in message
news:OI**************@TK2MSFTNGP10.phx.gbl...
SetAuthCookie will set an Auth cookie for the next request, i.e. cookie

will
be sent with the response. This way you can't use User.Identity to get an
information about just logged in user without receiving a new request with the new Auth cookie just set - you need to use your own mechanism.

"Andrew Banks" <ba****@nojunkblueyonder.co.uk> wrote in message
news:AC*********************@news-text.cableinet.net...
Using forms authentication in C# I usually use
FormsAuthentication.RedirectFromLoginPage to log a user in as follows

FormsAuthentication.RedirectFromLoginPage(id,false );

How can I log a user in without re-directing them somewhere else? I

simply want to log the in and then run some other code without re-directing them.
I've tried .SetAuthCookie(id,false) but this doesn't seem to work.

Any ideas?



Nov 18 '05 #7

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

Similar topics

60
by: Fotios | last post by:
Hi guys, I have put together a flexible client-side user agent detector (written in js). I thought that some of you may find it useful. Code is here: http://fotios.cc/software/ua_detect.htm ...
3
by: zlst | last post by:
Many technological innovations rely upon User Interface Design to elevate their technical complexity to a usable product. Technology alone may not win user acceptance and subsequent marketability....
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
7
by: jsale | last post by:
I'm currently using ASP.NET with VS2003 and SQL Server 2003. The ASP.NET app i have made is running on IIS v6 and consists of a number of pages that allow the user to read information from the...
0
by: tony | last post by:
Hello! This is a rather long mail but it's a very interesting one. I hope you read it. I have tried several times to get an answer to this mail but I have not get any answer saying something...
2
by: rn5a | last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with the IDs 'txt1' & 'txt2' respectively. To use this user control in an ASPX page, the following Register directive will be...
1
by: Carlettus | last post by:
Dear All, sorry but I'm not sure if this is the right place to post my problem. I was using the following asp code to create users in Active Directory. Suddenly, and I don't know the reason, users...
0
by: rbukkara | last post by:
Hi, I have got the following error while trying to add a user in the LDAP Directory. javax.naming.NameNotFoundException: ; remaining name 'uid=vassila,ou=People,dc=cs,dc=uno,dc=edu' I have...
9
by: Gordon | last post by:
I want to add a feature to a project I'm working on where i have multiple users set up on my Postgres database with varying levels of access. At the bare minimum there will be a login user who...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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,...

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.