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

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

Related

asp.net identity LoginView not switching to LoggedInTemplate

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.

Using Sessions in an ASP.NET 4.0 Log-In Control

I'm currently developing a website using Visual Studio 2010. As you all might know, creating a new website here automatically adds an Account folder which contains webpages like Login.aspx, etc. I am implementing this Login.aspx which contains the ASP.NET Login control. It's now functioning the way it should but I have a few concerns.
Before, I used to create my own UI for the log-in so managing sessions is not a problem to me. But since i'm currently using the Login.aspx which has a CS file almost empty, i don't have an idea where I can start implementing my session. Meaning to say, I don't know how to check programatically if the user has been successfully logged in so I can start implementing my session.
I would very much appreciate any pointer regarding this matter.
Thanks in advance. :)
You could subscribe for the Authenticate event and perform some custom authentication logic. Also you may take a look at the following article.
There are events associate with ASP.NET Login Control that you can use to create session like OnLoggingIn. Moreover you can find more about user validation from here Validating User Credentials Against the Membership

Simple Login Form

I have to create a simple ASP login page. We're not using Windows authentication or anything like that. The project is a conversion from a legacy VB6 program. Login accounts and passwords are stored in a SQL table, not the way to do it, but it is what it is. I can call the old login functions and redirect the window based on the return values.
Is there a decent-looking login form out there I could use? I tried the login control in the toolbox, but that thing seems to be married to Windows authentication.
I really just need an empty control that looks good. Any ideas?
Thanks,
Jason
Google for "Login Templates".. artfans.info/login-page-template-tag-style – Nikhil Bhandari

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.

Classic ASP to ASP.Net one-off session data copy

We have an extensive classic ASP site, and we're looking to upgrade to ASP .Net (most probably the latest version). Obviously upgrading all the pages at once would be a leviathan task, so we're only looking to write new pages (and page rewrites) in ASP .Net at first.
There are two obstacles to doing so:
I have no idea how to access classic ASP session data in ASP .Net. This would only have to be set up once, as it is never modified by any page other than the login page. I'd prefer to have to make minimal changes to the classic ASP login page, but that's only a small preference.
The ASP and ASP .Net sessions would have to timeout at the same time, to keep the version difference seamless.
Could anyone offer any help, please?
Thanks in advance.
We faced the same task (not fun). Since Asp.Net session and Asp session can't be shared, we used a combination of methods, each appropriate to the situation.
In some cases, we used cookies instead of session.
In others, we set up automatically posting forms so that if a user's session information was set in a classic ASP page, after the session info was set, we redirected to an Asp.Net page that read in query string parameters and used those to set the same session variables for Asp.Net. Then once the Asp.Net page set the same variables, that page did a redirect to whatever page the original login page previously pointed to. The same worked in reverse.
So, in the second scenario, an example flow would have changed from:
User tries to access some protected
content page -> redirected to login
page -> logs in -> session info set
based on login success -> redirected
back to content page.
to
User tries to access some protected
content page -> redirected to login
page -> logs in -> session info set
based on login success -> redirected
to a .net page, passing along login
credentials, etc. -> aspx page sets
session info and then immediately
redirects back to content page.
We knew it was a hack, but it worked in the short-term until we could get the sites all converted.
There might be a better way of doing this using newer IIS settings (must admit I've not kept up to date on what new goodies IIS7 can do). But you could do a XMLRequest from your ASP login page to a ASP.Net page. You could either pass through the settings you need in the Post data or have the .net page populate the session data itself if the logic is simple enough. The .net page would then return you a .net session id in the cookie, you need to set this in the ASP users cookie collection so that that user has both a .net and Classic ASP session cookie.
That would do it.
I implemented this a few years ago by using a database.
Microsoft have a pretty good article on it, though it's a little old at this point.

Resources