473,840 Members | 1,607 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 4006
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
5698
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
3026
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
1264
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
1420
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
2522
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
4870
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
2808
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
1114
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
2451
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
9699
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,...
0
10922
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...
1
10660
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
10301
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...
1
7838
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
5685
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...
0
5874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4076
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3138
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.