473,769 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Password Expiry check

Hi,
How can I do the below code in ASP.Net as I wish to provide an indication
to my staff on our Intranet site of when they will need to change there
password.

On Error Resume Next

Const ADS_UF_DONT_EXP IRE_PASSWD = &h10000
Const E_ADS_PROPERTY_ NOT_FOUND = &h8000500D
Const ONE_HUNDRED_NAN OSECOND = .000000100
Const SECONDS_IN_DAY = 86400

Set objUser =
GetObject("LDAP ://CN=myerken,OU=m anagement,DC=fa brikam,DC=com")

intUserAccountC ontrol = objUser.Get("us erAccountContro l")
If intUserAccountC ontrol And ADS_UF_DONT_EXP IRE_PASSWD Then ' LINE 11
WScript.Echo "The password does not expire."
WScript.Quit
Else
dtmValue = objUser.Passwor dLastChanged
If Err.Number = E_ADS_PROPERTY_ NOT_FOUND Then ' LINE 16
WScript.Echo "The password has never been set."
WScript.Quit
Else
intTimeInterval = Int(Now - dtmValue)
WScript.Echo "The password was last set on " & _
DateValue(dtmVa lue) & " at " & TimeValue(dtmVa lue) & vbCrLf & _
"The difference between when the password was last" & vbCrLf & _
"set and today is " & intTimeInterval & " days"
End If

Set objDomain = GetObject("LDAP ://DC=fabrikam,DC= com")
Set objMaxPwdAge = objDomain.Get(" maxPwdAge")

If objMaxPwdAge.Lo wPart = 0 Then
WScript.Echo "The Maximum Password Age is set to 0 in the " & _
"domain. Therefore, the password does not expire."
WScript.Quit
Else
dblMaxPwdNano = _
Abs(objMaxPwdAg e.HighPart * 2^32 + objMaxPwdAge.Lo wPart)
dblMaxPwdSecs = dblMaxPwdNano * ONE_HUNDRED_NAN OSECOND ' LINE 37
dblMaxPwdDays = Int(dblMaxPwdSe cs / SECONDS_IN_DAY) ' LINE 38
WScript.Echo "Maximum password age is " & dblMaxPwdDays & " days"

If intTimeInterval >= dblMaxPwdDays Then
WScript.Echo "The password has expired."
Else
WScript.Echo "The password will expire on " & _
DateValue(dtmVa lue + dblMaxPwdDays) & " (" & _
Int((dtmValue + dblMaxPwdDays) - Now) & " days from today)."
End If
End If
End If

Code snippets appreciated!
Kenneth
Nov 18 '05 #1
0 1499

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

Similar topics

7
11025
by: Geoff Muldoon | last post by:
Hi all, Help please. Environment: Unix (Tru64) / Apache / PHP4.0.6 / Oracle8i Establish connection to Oracle: for ($I=0; $I<$max_attempts; $I++) {
0
1294
by: Lim Eng Teik | last post by:
I was asked by a client to make changes for their Outlook Web Access page where I need to validate Expiry Date of the Password and also the Password Length for the NT Account Policy. Initially I use javascript to do a static validation for the password expiry and password length. There request now include dynamic changes to the Javascript where if the password length is changed on the NT Account Policy, it will reflect on the client side...
1
2093
by: Hardeep Rakhra | last post by:
Hi i have a snippet of JS that i want to change so that the cookie it creates lasts only 48 hours. (or any other length of time i decide, but 48hours seems right for now) Only thing i can't figure out how it specifies the expiry time. Thanks! Hardeep
3
9260
by: hasanainf | last post by:
Hi all, What will be the best database design for an inventory control that uses expiry date for its products. Over a period of time, a particular product will have many expiry date and that one particular expiry date could have multiple products I am thinking of two approaches not knowing which one to go for. First design is of one product having many expiry dates (a one to many
2
1752
by: KatMagic | last post by:
I have a web-based program that will be going to an external web server and want to create a logon process. I am using forms authentication, passing encryption with salt, but want to force the user to create passwords with rules: combinations of numbers & letters, at least one character caps, things like that, like we would on a a network, and to change the password every x amount of months. Can anyone point me in the right direction as...
6
25136
by: mymatebob | last post by:
Hi, I am using cookies to keep track if a user is logged into my system, and would like to display the time that the user has left logged in. One solution is to display the time left until the cookie expires. Does anyone know how to retrieve the expiry time of a particular cookie? TIA
1
1873
by: Rob Kell | last post by:
I have a vb.net application that emails people daily information. I want to set an expiry for the email so that those who cannot check their emails for a period are not loaded with them when they are finally checked. Please help
2
3086
by: fijsolam1981 | last post by:
Hi, I had created a web application where Session expiry was set to 2,000 minutes in IIS. in web config i had given like this <sessionState timeout="2,000" mode="InProc"></sessionStatebut MY web application was left logged in at 18:00 15th Oct, but on the following day 08:30 16th Oct, the session expired as soon as MY web application was used. It was also noted that during the day, MY web application occasionally got session expiry when...
0
1519
by: vaidehi | last post by:
hi all!! pls help me.. in /etc/login.defs, changed PASS_MAX_DAYS value from 99999 to 30 PASS_MAX_DAYS 30 PASS_MIN_DAYS 0 PASS_WARN_AGE 7 after this if I create a user, his password will expire after 30 days. But existing users' passwords do not have any expiry date.. so they will never going t o be asked for a new password after 30 days.. So how do i change the password expiry...
0
9579
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
9422
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
9987
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
9857
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
8867
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
7404
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
5294
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...
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2812
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.