473,387 Members | 1,628 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,387 software developers and data experts.

code to login manually

how can i log in programatically?

i want my users to be able to specify username & password in a session var
as an option
Jun 27 '08 #1
4 1848
I tried this:
If Membership.ValidateUser(Request.QueryString("Usern ame"),
Request.QueryString("Password")) Then
Response.Redirect("members/ViewAccount.aspx")

But, even though the login is correct, pages which I should be able to view
(because I'm a logged in user) I can't see. I'm auto-redirect to the login
page.

Any ideas?

"Cirene" <ci****@nowhere.comwrote in message
news:ek*************@TK2MSFTNGP04.phx.gbl...
how can i log in programatically?

i want my users to be able to specify username & password in a session var
as an option

Jun 27 '08 #2
FormsAuthentication.SetAuthCookie(Request.QueryStr ing("Username"), True)

That's the solution! Thanks.

"Cirene" <ci****@nowhere.comwrote in message
news:uD**************@TK2MSFTNGP02.phx.gbl...
>I tried this:
If Membership.ValidateUser(Request.QueryString("Usern ame"),
Request.QueryString("Password")) Then
Response.Redirect("members/ViewAccount.aspx")

But, even though the login is correct, pages which I should be able to
view (because I'm a logged in user) I can't see. I'm auto-redirect to the
login page.

Any ideas?

"Cirene" <ci****@nowhere.comwrote in message
news:ek*************@TK2MSFTNGP04.phx.gbl...
>how can i log in programatically?

i want my users to be able to specify username & password in a session
var as an option


Jun 27 '08 #3
Hello Cirene,

You forgot to call FormsAuthentication.SetAuthCookie

Response.Cookies.Remove(FormsAuthentication.FormsC ookieName);
FormsAuthentication.SetAuthCookie("username", false);
Response.Redirect("samepage.aspx");

Also, you can use the AJAX login, see sample there http://weblogs.asp.net/andrewfrederi...r-asp-net.aspx

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
Chow can i log in programatically?
C>
Ci want my users to be able to specify username & password in a
Csession var as an option
C>
Jun 27 '08 #4
Thanks Michael!

"Michael Nemtsev [MVP]" <ne*****@msn.comwrote in message
news:90**************************@msnews.microsoft .com...
Hello Cirene,

You forgot to call FormsAuthentication.SetAuthCookie

Response.Cookies.Remove(FormsAuthentication.FormsC ookieName);
FormsAuthentication.SetAuthCookie("username", false);
Response.Redirect("samepage.aspx");

Also, you can use the AJAX login, see sample there
http://weblogs.asp.net/andrewfrederi...r-asp-net.aspx

---
WBR, Michael Nemtsev [.NET/C# MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

Chow can i log in programatically?
CCi want my users to be able to specify username & password in a
Csession var as an option
C>

Jun 27 '08 #5

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

Similar topics

4
by: nicholas | last post by:
Hi, Got an asp.net application and I use the "forms" authentication mode defined in the web.config file. Everything works fine. But now I would like to add a second, different login page for...
2
by: Assimalyst | last post by:
Hi, I am creating a website where i want to allow some webforms to be accessible to all users, and those in a subdirectory available only to authenticated users. I have created a script to...
8
by: Keith H | last post by:
I'm looking for a way to force the user to re-authenticate with their Windows username/password/domain after clicking the submit button on an ASP.NET page. This is for an internal application. ...
7
by: Samuel Shulman | last post by:
Is there a method that will indicate the person who logged successfully is Logged and therefore allowed to browse freely other then using the...
2
by: Morgan Cheng | last post by:
In VS2005, I create a ASP.NET website project.One page named Default.aspx with LoginView and LoginStatus controls; and one page named Login.aspx with Login control in it. After setup of users, I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.