asp.net identity LoginView not switching to LoggedInTemplate - asp.net

I have just started working on ASP.NET Identity. I created a web forms project in VS2013 using the Web Forms template.
Then I added BotDetect CAPTCHA in Register.aspx. I Registered the first user so that the Identity schema is created. so far so good.
Now, I observe a very strange thing - I start debugging my application - it shows me the home page. I click on "Log In" menu and the login page is shown. I enter the credential and click on Login. The user successfully logs-in (signinManager.PasswordSignIn returns SignInStatus.Success); however the LoginView does not switch to LoggedInTemplate.
Now, I just go to Register page and then go to Login page, then Login and this time the LoginView switches to LoggedInTemplate properly.
This has happened consistently - unless I go to the Register page the LoginView won't switch to LoggedInView.
Further, I commented the CAPTCHA code (but not the configuration done in the web.config). Now, even if I go to Register and then try to Login nothing happens (LoginView remains in AnonymousTemplate).
Is there any connection between LoginView and BotDetect CAPTCHA?
Please let me know if any more info is needed.
Thank you.
UPDATE:
I removed the BotCAPTCHA entirely from the project and now the LoginView correctly switches to LoggedInTemplate! My guess is that BotCAPTCHA does URL Rewriting and this is affecting it. I have posted this to BotCAPTCHA support and will Update here once they reply me.

Related

asp.net identity login page login will work after visiting register then back to login page

I have come across something very strange and just cannot figure it out. I have a web forms app in C# created in VS 2015 using 4.5 framework. I have made no changes to the login page or login.cs at all.
I start up the site, enter my valid login credentials, and hit enter. Page just goes to the default page and I am not logged in. BUT if I go to the register page by clicking the register link and then go back to login and enter my valid credentials I am logged in as expected.
As I said, I have made no changes to the login form or cs file. Very odd behavior. Has anyone encountered something like this?
So I figured if anyone sees this and has the same issue I can hopefully help them. In my instance it was the botdetect captcha causing the issue.
Removing "sessionIDManagerType="BotDetect.Web.CustomSessionIdManager, BotDetect" resolved my issue.

Asp.net IIS7 keep prompting user credentials for non admin users

I have an ASP.net website which is set to operate on Windows Authentication. It runs on IIS7 with windows authentication on. Every user who isn't from administrator group, Internet Explorer keep prompting for user credenials. Though when user clicks on cancel, the web site runs ok as long as user does not click on any page control.
I have a master page with telerik controls on it. This page contains AJAX Manager and ScriptManager. If user call an aspx page without master page, the credential windows doesnt appear.
Telerik resources are registered in web.config..and as I said the website works without problem for admin group. Normal users are also from the same domain..but for them login windows keep coming...
any idea?
The website is not registerd under trusted intranet sites..but this shouldnt be a problem as otherwise admin should also get error message.
Regards
I am answering my own question as it might be helpful for others too.
I was finaly abled to track down the issue with the help of Process Monitor. http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
It turned out that one of the CSS file didn't have enough permissions for normal users.

in asp.net login component doesn't redirect

Dear Experts,
I'm working with visual studio 2010
I’ve put a login component on my page, and defined users and roles in the asp.net web application administration
I don’t know why, but it’s not working, it’s not redirecting to the start page
It verifies the right and wrong passwords, and once it’s correct user name and password it doesn’t redirect… it just refresh the page and do nothing
Now, I thought I could debug step by step to know where it goes wrone, but since there is no code written , I don’t know where to put the breakpoint… that is my question
Please can you help me
.
If the login is succesful, to redirect the user to another page you should use the DestinationPageUrl property of the login control.

Run custom code on login

I’ve used the asp.net login control on my sharepoint custom master page. All works well and I can login to my site without problems.
However I’d like to run some code once the user has logged, or alternatively perform a redirect based on the user’s role.
Has anyone does this type of thing before?
The Login control (System.Web.UI.WebControls.Login) has an event LoggedIn (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.login.loggedin.aspx). Just subscribe to it and place your code in the handler. I haven't worked with sharepoint, I'm talking from an ASP.NET viewpoint here.
You can test roles programmatically through User.IsInRole
EDIT: on redirect from the ASP.NET login control, check for the forms authenication token and run your custom code if the token is present.

Passing/Getting the session("userid") on login page. IN virtual studio -> vb

Passing/Getting the session("userid") on login page. IN virtual studio -> vb
How can get with the vs login box ??
In ASP.NET, the normal methodology is to use the login control. YOu can set up, in the web.config file, to redirect to the page with this control whenever a user is not logged in.
The fact you are sending things via session suggests you are either using ASP or you are still caught in the ASP paradigm, as there is no reason to take control of this part of your application. Even if you have a completely different methodology for login, you can create a custom provider and still use the underlying built in bits. Why reinvent the wheel when you don't have to.
I am not sure what you mean by the VS login box, however.
Here is a link to an MSDN article on using the login control. Perhaps it will help:
http://msdn.microsoft.com/en-us/library/ms178329.aspx

Resources