474,052 Members | 2,351 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HOWTO: Programmaticall y Login User in ASP.Net 2.0

I want to bypass requiring the intranet domain user to type in a username and
password when coming to my website, even the very first time.

If it's the first time I do a Membership.Crea tUser passing the username,
gotten from ServerVariables ("LOGON_USER "), a constant password (all users
have the same password), and an email address built with the username and a
constant domain name from the intranet.

However, things like User.Identity.N ame are still blank.

How do I programmaticall y login a user so that everything acts just like
when the user enters his username and password on a 'Login.aspx' page?
--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
Jul 21 '06 #1
2 4019
Yo,

What you have to do is set an authentication cookie by doing the
following:

[c#]
FormsAuthentica tion.SetAuthCoo kie(userName, bool);

This way asp.net will load up the information for that username's info,
profile, etc.

If you need to manually load up the profile and gather some info first
before you do anything, use this:

ProfileCommon thisProfile = Profile.GetProf ile(userName);

Good luck.

-Brenton

Dan Sikorsky wrote:
I want to bypass requiring the intranet domain user to type in a username and
password when coming to my website, even the very first time.

If it's the first time I do a Membership.Crea tUser passing the username,
gotten from ServerVariables ("LOGON_USER "), a constant password (all users
have the same password), and an email address built with the username and a
constant domain name from the intranet.

However, things like User.Identity.N ame are still blank.

How do I programmaticall y login a user so that everything acts just like
when the user enters his username and password on a 'Login.aspx' page?
--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
Aug 16 '06 #2
Thank you for the response. I'll try your recommendation( s).

--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
"br*****@ungern et.com" wrote:
Yo,

What you have to do is set an authentication cookie by doing the
following:

[c#]
FormsAuthentica tion.SetAuthCoo kie(userName, bool);

This way asp.net will load up the information for that username's info,
profile, etc.

If you need to manually load up the profile and gather some info first
before you do anything, use this:

ProfileCommon thisProfile = Profile.GetProf ile(userName);

Good luck.

-Brenton

Dan Sikorsky wrote:
I want to bypass requiring the intranet domain user to type in a username and
password when coming to my website, even the very first time.

If it's the first time I do a Membership.Crea tUser passing the username,
gotten from ServerVariables ("LOGON_USER "), a constant password (all users
have the same password), and an email address built with the username and a
constant domain name from the intranet.

However, things like User.Identity.N ame are still blank.

How do I programmaticall y login a user so that everything acts just like
when the user enters his username and password on a 'Login.aspx' page?
--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS

Aug 16 '06 #3

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

Similar topics

4
5709
by: Philipp Ott | last post by:
Hello! I m looking for a solution to generate a digitally signed mime-email with linux/perl and to feed/pipe this then to sendmail. I found RFCs related to mime-signed etc. but somehow fail to implement them or rather make it work. Is there a fininshed cpan module that can do this? I didnt find one though. Second, what if i want to use verisign/thawte digital certs for email
1
3037
by: Martine | last post by:
Hi there! I have a problem with programmatically adding user controls to my mobile webforms. If I load my usercontrol programmatically (in the Page_Load), the object is instantiated, I have access to the methods and properties from the Page_Load, no problem there. But as soon as I want access to the user control from another procedure on the same page, I get the next error message: "Object reference not set to an instance of an...
0
1271
by: Dan | last post by:
hi ng, is there a way to set a custom login failed page when using windows authentification? my settings are: --------------------- <authorization> <allow users="x,y,z" /> <deny users="*" /> ---------------------
2
1428
by: Dan Sikorsky | last post by:
My website users will all come from the same domain after they first login to the network in the morning; therefore I would like to use the benefits of Windows Authentication. But I would like to use the benefits of the Membership system for things like controlling access to certain web pages using Roles, password retrieval, etc. I think the best way to use both authentication systems is to declare Forms authentication in the web.config...
3
2529
by: Dan Sikorsky | last post by:
How do you get a reference to the LoginStatus control contained in the LoginView control that resides on web.master? I need to determine if the LoginStatus will show a LogOut link(for a logged in user), or show nothing at all (in the case of the user not logged in); Are there any other Membership properties that I can call that tell if the user has already authenticated.? --
10
4896
by: perplexed | last post by:
After a user logs in (ASP.NET 2.0 membership/roles), how do I programmatically access their UserId and other information stored in the ASP.NET database structure? A user may login at Login.aspx and then they are redirected to somepage.aspx. somepage.aspx doesn't have a reference to the login object and can't access UserId. Also, are there any issues with changing the UserId column from a uniqueidentifier to an integer IDENT? Thanks.
2
2822
by: Pawel | last post by:
Howto: Programmatically serialization Entry Method Parameters ( their values ) ? See example below: public static void C(string Code, string Name) {
2
1121
by: Sagaert Johan | last post by:
Hi How can i only allow downloading a file if a user has logged in ? I have an aspx page with links to downloadable files, a users needs to enter a login/pw before he can see the page, but if he bookmarks the url's to the download link, he can bypass the login page. So my login / pw protects access to the page with downloads links but not to the downloads itself..
2
2469
by: David | last post by:
Hello, I would like to know how to post form data programmatically. The idea is to get the intranet web page, programmatically entre the username and password in a login form, post it and be redirected to the logged in page. So far I have found the code to post data in a form, but I am not sure if this is the correct way to do it. Thank you in advance
0
10563
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
12178
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11623
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8727
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
7886
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();...
0
6677
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
5434
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
4954
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3993
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.