Membership Create Users, Logging In Works. But Then It Doesn't?
Feb 14, 2011
I have a application that connects to a remote sql server. I am able to create users and they are stored in the DB. Then I can go to the login page and login. But after a while, I am unable to log in and it just sits at the login page. The user is still in the DB
I had to upgrade a sites ecuroty from a custom system to .net membership. I created all the users like this.
ds = Wservices.SelectBulkUsers() If Not ds Is Nothing AndAlso Not ds.Tables(0) Is Nothing AndAlso ds.Tables(0).Rows.Count > 0 Then For Each dr In ds.Tables(0).Rows username = dr("username") password = dr("password") role = dr("SecurityClearance") email = dr("email") Dim newUser As MembershipUser = Membership.CreateUser(username, password, email, "", "", True, status) Select Case role Case "1" Roles.AddUserToRole(username, "normal user") Case "2" Roles.AddUserToRole(username, "administrator") Case "3" Roles.AddUserToRole(username, "super administrator") End Select If newUser Is Nothing Then errorMsg = username & " - " & status.ToString & "<br />" End If Next litResult.Text = errorMsg End If
I thought everything was fine and then went through the labourious task of replacing all the usersids used a as a foreign key in all the tables. It was only after doing this and trying to log on I couldnt, and noticed the membership table was empty. I assumed (stupidly) as it had done the users/ roles it must have done the membership. As I have already re-assigned the old user ids I dont want to import again as the userid will chnage. So my question is: Can I create a membership for each of the users in my aspnet_users table? I have the passwords etc in varchar fields at min from old table.
I want to migrate users and posts from an existing forum I am using to a ASP.NET membership table without using CreateUser. Basically I want to maintain userIDs so that when I migrate posts they continue to associate with the correct users. Is there a way to do this or would I be better off just using CreateUser and then finding a way to re-assign the post-by-UserIDs to the correct new IDs?
I'm have a doubt using membershipuser to create users in the AD with Membership.CreateUser Method, does any one knows how can i send other attibutes to the AD, such as First Name and Last Name?, besides those ones: username
The db connection seems to work. I can create new users with the new user wizard control. And they show up in the databaser. But i cant log in. I use the log in control and just get "wrong password". I am sure i type the correct password as i made it very easy. here are my webconfig settings.
There is one thing i have no clue how to configure. The APPLICATION NAME. What is it? And what should i set it to?
need to slightly tweak the functionality of the ASP.NET Membership provider to add custom logging functionality. Instead of creating a wrapper class around the methods I wish to modify, I was toying with the idea or creating a custom Membership Provider and override a few of the methods.All the examples I could find would show how to create it from scratch. I don't want to overwrite everything... just override a few methods. Can somebody point me in the right direction?I can simply inherit from SqlMembershipProvider and override the methods. However, how can I get at the connection string?
I have a default page which has the login control, this page is in the main directory. Then I have a bunch of pages that I only want viewable to people that have logged in a "MemberPages" directory. My problem is when I click on login button on the default page, using a username and pass that is not in the DB, it still takes me to all my member pages
I went through the asp.net config and set the "MemberPages directory to deny all not auth users. But it still has the faded one that is inherited from the main that allows all and cant be changed (maybe that is the problem? But I can't delete it) What else?
Here is my web.config from the MemberPages directory.
When a user logs in into my website I have a custom membership provider that overrides ValidateUser and verifies that the user has sufficient rights etc.
However, when implementing a 'remember me' function through the default forms authentication using RememberMeSet, I also want to validate a user on the first request.
Is there some hook I can attach to that triggers when a user logs in with their persistent cookie?
I recently inherited an asp.net website made up of multiple .aspx and .ascx pages and being rather new to web development and especailly asp.net. I have the site create a cookie upon login to automatically log users back in if the page times out on them while they're entering information.
I need the site to automatically log users out when the site is closed. Obviously using the me.close event on each page won't work because we don't want it to log people out every time they navigate to a new page in the site.
I've tried setting the timeouts in both IIS and in the files of the website to longer but it doesn't seem to have an effect.
Is there an easy way to automatically log users out when they leave the site but not when they navigate from page to page.
I'm debugging some unexpected behavior and while tracing in to the .NET framework I see a bunch of stuff like this:
if (Logging.On) { Logging.PrintInfo(Logging.Web, this, SR.GetString(SR.net_log_n_certs_after_filtering, filteredCerts.Count)); ... }
But (as expected by default) the execution steps right over these. Is there some way to turn on the logging? Or is that just something that the framework developers can do while making special builds of the framework?
We use windows authentication. User opens our website in tab1 and does some action but with out clicking on save he opens a new tab tab2 and opens the same website again. Now, if the user session in tab1 is active i need to warn users that the he is already logged on to application in some other browser and go to some log out page. But if the user session in tab1 is timed out then he must be able to continue with the website in tab2 as usual, but if he tries to do anything in tab1 he should go to session expired page. I tried implementing it in following way.
I have a hidden field in each page which will be set to unique Id using GUID.NewID(). when user requests for a page the following code is executed.
I'd like to know how membership providers works under the hood, if it uses cookies, session, the principal and identity thread objects, etc.. etc.. where can I find information?
I understand that probably this is not good forum for asking this question, but I'm a bit dissapointed, and I don't know where I can found answer to my question. Here is my problem. I've got a page that has dynamically loaded content with innerHTML like below:
[Code]....
Everything works fine .. since I wanted to have gif shown when page content is loading. But now I would like to after loading innerHTML content to execute javascript function to create pieChart of something. The problem is that I have to use document.getElementById()function, but it does not works with content loaded dynamically. I mean, Lets say that inside page loaded by innerHTML we've got a form which id="A" when instead pieChart() in above code i will use document.getElementById('A') it does not return my form. I've checked this in IE7 with no effect, ffox also does not seems to work. The only one browser that works at the moment is Chrome.
I'm trying to make some calls to a WebService I did exactly what is described in this article [URL] Looking at the console of firebug I could see that my function was executed and returned the expected data, but my callback functions (OnComplete, OnError, OnTimeOut) are never executed. Whats wrong? Here is the code (same code of the article)
Service.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; [WebService(Namespace = "[URL]")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. // [System.Web.Script.Services.ScriptService] [System.Web.Script.Services.ScriptService()] public class Service : System.Web.Services.WebService { public Service () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string HelloWorld(string strNoOfData) { return strNoOfData; } } Default.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]"> <html xmlns="[URL]"> <head runat="server"> <title></title> <script type="text/javascript" language="javascript"> function CallService() { Service.HelloWorld(document.getElementById('Textbox1').value, OnComplete, OnError, OnTimeOut); } function OnComplete(Text) { alert(Text); } function OnTimeOut(arg) { alert("timeOut has occured"); } function OnError(arg) { alert("error has occured: " + arg._message); } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="~/Service.asmx" /> </Services> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server"> <ContentTemplate> <fieldset> <asp:TextBox ID="Textbox1" runat="server"></asp:TextBox> <br /> <asp:Button ID="Button1" runat="server" Text="Call Service" OnClientClick="CallService()" /> </fieldset> </ContentTemplate> </asp:UpdatePanel> </div> </form> </body> </html>
I have an asp.net web app that uses forms-based authentication, a SqlMembershipProvider (using an encrypted password format), and a SqlRoleProvider. I need to know if it's possible to administer the users (create new users, assign them to roles, etc.) from a windows application - the powers that be don't want any administrative functionality in the web app itself.
Here is the membership provider definition from web.config:
[code]....
So, obviously, I have a Sql Server database that contains the users and roles for the web app. I'd like to create a separate windows app that references the web app assembly, and use the configured MembershipProvider, RoleProvider, and machineKey to create users, assign users to roles, etc. If that's not possible, I can duplicate the configuration settings from web.config within the windows app. But I don't know how to do this either.
AutoCompleteExtender (4.1.4.0) in update panel in user control (ascx) and webservice under his ascx.vb and doesn't works.
So I've tested the same markup and webservice method in a simple aspx page and works, so I've some doubt:
- AutoCompleteExtender works in ascx file with webservice function under his code?
- AutoCompleteExtender works in an update panel?
I've always problem to create webservice method using wizard on the control, it return always: Cannot create page method GetCompletionList because no CodeBehind or CodeFile was found! - but I've CodeBehind file..sure!
I have an asp web app contains ajaxtoolkit's controls. Everything is working fine on VS Development Server, but doesn't on IIS7 (win 2008).
The AjaxToolkit's scriptcombine sometimes is not working (resulted http 404 status code on browser). Maybe causes by long TSM_HiddenField query string on complex toolkit's controls.
Clicking the buttonfield deletes the record just fine. Clicking the LinkButton doesn't work. I get a postback and the grid is shown as empty and no record is deleted. Seems like an empty databinding. I have tried to create a custom OnClick, OnCommand event for the LinkButton, but neither are fired. The OnRowCommand isn't fired either.