Hi.,
I have developed on sample wed application to authenticated on active directory user group member wise.username and password is available to authenticated is true.but user is not avilable to redirect to login page...
Thanks,
K.Karthick
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sandhiya PriyaPosted Nov 8, 2025, 11:21 AM
Common Root Causes
When AD authentication works but redirection fails, it’s usually due to one of the following:
Authentication is true, but authorization (role/group check) is not satisfied.
Missing or wrong FormsAuthentication.RedirectFromLoginPage() call.
web.configauthorization rules misconfigured.Session not created before redirect.
IIS or Windows authentication conflicts with your app authentication.
Step-by-Step Fix
1. Validate your AD authentication logic
Make sure your login code looks something like this:
Response.Redirect("Home.aspx")should point to your post-login page.2. Ensure Forms Authentication in
web.configAdd these sections:
This ensures unauthenticated users are redirected to the login page.
3. Check redirection logic
Instead of manually redirecting, you can use:
It automatically redirects to the originally requested page or defaultUrl.
4. Verify Session or Cookie Handling
Sometimes redirect fails because the session/cookie isn’t created:
Ensure cookies are enabled.
Check if
matches your environment (especially if using HTTPS).Don’t call
Response.Redirectbefore setting cookies.5. IIS Settings (Important!)
If your IIS is using Windows Authentication, disable it for your app:
Go to IIS ? Your App ? Authentication
Enable: Anonymous Authentication
Disable: Windows Authentication
Otherwise, the redirect may be blocked by Windows login popup.
6. Debug the Redirection
Add a quick test:
If you see “Redirecting…” in the browser, your code is working; if not, something is stopping the redirect (e.g., thread abort, unhandled exception, or missing page).
Bonus Tip — AD + Roles Authorization (if using role-based pages)
In
web.config, you can restrict access:Brenda BaileyPosted Nov 7, 2025, 12:35 PM
It sounds like the authentication works but the redirection logic might not be triggering correctly. Check your post-authentication conditions or redirect configuration to ensure the user flow continues after login.
Sandhiya PriyaPosted Oct 29, 2025, 10:14 AM
you’ve built an ASP.NET Web Application (probably MVC or WebForms) that authenticates users against Active Directory (AD) using their username and password. Authentication works fine, but users aren’t redirected to the login page (or after login, maybe not redirected properly).
Let’s clarify and fix this step-by-step
Step-by-Step Solution
Step 1. Clarify What’s Happening
From what you said:
You are using AD authentication (
System.DirectoryServices.AccountManagementorLDAP)You can successfully authenticate username/password (so authentication works )
But redirecting to the Login page or the secured area isn’t happening
That means your Forms Authentication / Claims Principal / Authorization pipeline is missing or not correctly configured.
Step 2: Typical AD Authentication Flow in ASP.NET
Here’s how it should work:
This sets the authentication cookie and redirects the user.
If
FormsAuthentication.SetAuthCookie()orResponse.Redirect()is missing, the user won’t be redirected.Step 3: Check
web.configMake sure you have the correct authentication settings:
This ensures:
Anonymous users get redirected to
Login.aspx.Authenticated users can access pages under your secured folder.
Step 4: Verify AD Group Authorization (Optional)
If you also want to restrict access by AD group, use this:
That ensures the user must belong to
YourADGroupNameto proceed.Step 5: Check
web.configAuthorizations for Folder/PageFor example, to protect
/Adminfolder:Step 6: If Still Not Redirecting
Check these issues:
Step 7: Example Full Login Code (WebForms)
Quick Test Checklist
Optional: Using Windows Authentication (If in Intranet)
If it’s an internal corporate app (domain-joined users), you can skip manual login entirely:
Then check in code: