.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

error with Membership.GetUser(NewUserWizard.UserName)

Posted By:      Posted Date: September 22, 2010    Points: 0   Category :ASP.Net

on the third line of code I get message that "NewUserWizard" is not declared.  How can I remedy this?

Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserWizard1.CreatedUser
        ' Get the UserId of the just-added user
        Dim newUser As MembershipUser = Membership.GetUser(NewUserWizard.UserName)
        Dim newUserId As Guid = CType(newUser.ProviderUserKey, Guid)

        ' Insert a new record into UserProfiles
        Dim connectionString As String = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString()
        Dim insertSql As String = "INSERT INTO UserProfiles(UserId, HomeTown, HomepageUrl," & _
            "Signature) VALUES(@UserId, @HomeTown, @HomepageUrl, @Signature)"

        Using myConnection As New SqlConnection(connectionString)
            Dim myCommand As New SqlCommand(insertSql, myConnection)
            myCommand.Parameters.AddWithValue("@UserId", newUserId)
            myCommand.Parameters.AddWithValue("@HomeTown", DBNull.Value)

            myCommand.Parameters.AddWithValue("@HomepageUrl", DBNull.Value)
            myCommand.Parameters.AddWithValue("@Signature", DBNull.Value)

View Complete Post

More Related Resource Links

Membership.GetUser().UserName On Login Page



I have an Employee class in my App_Code folder.  On my login page I am trying to create an Employee using the asp.net username as a parameter in my Employee constructor.

 I have tried creating the employee in the page load event when it is a post back.  I have tried doing it in the Login1_LoggedIn event.  For some reason I cannot pull the username in either one of these places, but if I redirect after logging in and do the same thing on another page, it works.

How can I get it done on the login page?


  Dim em As Employee

        em = New Employee(CInt(Membership.GetUser().UserName))


Membership.GetUser() issues

HI all, I've got a claims based SharePoint 2010 environment configured.  I'm able to register new users, login etc.  I'm now trying to get more detail from the current logged in user and for this, I understand, I need to use the MembershipUser, Membership and MembershipUserCollection classes. When I instantiate the MembershipUserCollection class and traverse the users, all works fine, but as soon as I try to create an object from the currently logged in users, I get an error noting "method or object not implemented". Here is my code: MembershipUser user = Membership.GetUser(strCurrentIdentity);  <!-- Exception on this line. strCurrentUser = user.UserName; ps.  Let's assume I have trim the "strCurrentIdentity" down to only have the username portion in it.  http://technicallead.wordpress.com/

Membership web part 'Object Expected' error

I have placed a Membership Web Part on my 'My Site'/'My Content' page and everything was working just fine until the number of memberships supassed the total number that the control is set to display. When this happened, a link appeared at the bottom of the web part with the following wording 'Show 8 additional memberships'. When I click on this link I receive an 'Object Expected' javescript error. When I look at the code that is generated on the page the <a></a> tag for this link appears as follows ... <a class="ms-vb" id="1SPS_MEMMICSRCHRES_Link" href="javascript:ShowHidePrivacyRow('SPS_MEMMICSRCHRES','1', '1SPS_MEMMICSRCHRES_Link', 'Hide 8 additional memberships', 'Show 8 additional memberships');"> When I do a search for the ShowHidePrivacyRow() function it does not appear on the page and I can not seem to find it in any of the SharePoint out of the box .js files either. Could this be the cause of the 'Object Expected' error? If so, how do I solve this and why is an out of the box web part causing javascript errors. This is something I would expect from a product that is still in Beta, not a production release.

How to override Membership.GetUser() ?


hi , i have add a new column (CustomeAuth) to aspnet_Users but i need to get the value of this column just like:


so i can use :


Thanks and regards,


Membership.deleteUser error


 I have problem with deleting user using Memebership.deleteUser('username',true) because of the exception:

The DELETE statement conflicted with the REFERENCE constraint "FK__aspnet_Me__UserI__15502E78". The conflict occurred in database "jobpro", table "dbo.aspnet_Membership", column 'UserId'.
The statement has been terminated.

But it only happens when method is called from IIS. When I run it on development server everything works fine.

I've noticed that when deleteUser function is called from IIS in stored procedure
aspnet_Users_DeleteUser line:

EXISTS (SELECT name FROM sysobjects WHERE name = N'vw_aspnet_MembershipUsers')

Returns false.

Thanks in advace for any help.

Best regards.



Membership.GetUser() using FireFox browser


I am finishing up my asp.net web application targeting .net 4.0. I am using VS2010.

I have deployed my application to a host server and now I am testing with multiple different browsers.

The first issue I ran into comes down to the following code:

            MembershipUser currentUser = Membership.GetUser();
            if (currentUser != null)

If I use IE, login and click something that causes the above code to execute then currentUser is NOT null. However doing the exact same steps in FireFox currentUser is null, even though I know I am logged in as my name and other indications on the webpage confirms I am.

Anyone have any ideas why this would be? 





Since originally posting this thread I have done more testing.

I placed a test button on a random page and the button click will update a label on that page indicating if the currentUser is null or not. This button works both in IE and in FireFox. Also both running locally and running on the host server.


So now I am looking at what is different about the one place it appears not to work so let me try to make this clear.

I use a component called Uploadify to upload images into a database. That componen

Membership - Change username


I am trying to use the email address as the username in my application but am obviously running into issues if the user needs to change their e-mail address.  I have searched the forums and have come across a couple posts that look like something I am trying to do but don't quite get me there.

 I found this post - http://forums.asp.net/t/911360.aspx?PageIndex=2 and was trying to use the code from Scott W.  The problem is that I am using VB and this example code is in C#.  I tried converting it but am having issues.

public bool UpdateUserNameAndEmail(string currentEmail, string newEmail)
MembershipUser memUser = Membership.GetUser(currentEmail);
  memUser.Email = newEmail;

FAST Search Server 2010 Config Error - ValidationException 1034: Username or domain is incorrect.



I've seen other related threads and I've tried all the tricks in getting through the post-setup configuration, but I can't get by the "ValidationException 1034: Username or domain is incorrect." error message taken from the FAST psconfig log. I've tried both the wizard and the psconfig, but get the same results. I'm attempting to deploy the single server (stand-alone) on a single x64 box, under ws2008 SP2, w/SP2010, the server is also the domain controller, and i've been passing the FQDN to the post-setup script as described in the FAST deployment document (see log below):

Verbose [1] PostSetupUI - Displaying next panel :Enter the user name and password
Verbose [1] PostSetupUI - Displaying button set to the default settings
Verbose [1] PostSetupUI - Next button clicked
Verbose [1] PostSetupUI - Starting to process form data of panel :Enter the user name and password
Verbose [1] PostSetupUI - Collecting input parameters from the text input controllers.
Verbose [1] PostSetupUI - Collecting value:dev.devnet.com\fastuser of input parameter: userName
Verbose [1] PostSetupUI - Adding config parameter: userName for the next validation parameter batch
Verbose [1] PostSetupUI - Collecting value of input parameter: password
Verbose [1] PostSetupUI - Adding config parameter: password for the ne

Error throwing in Membership class


I want to check the user credentials of asp_net Membership database, for that While using the Membership class it is throwing "Operation is not valid due to the current state of the object".

access denied error in custom login page using custom membership provider/ roleprovider in the FBA u



I have deployed my custommebrship assembly and role provider assembly in the sts web config , central admin web config  and current web appln web config 's. i have created a  dll which has  login control and in the sign_authenticate event i am creating the securitytoken.

when i establish a session using the security token created using the iissettings object, and  while tryibng to redirect to the   home page of the/landing page of the web appln am Getting access denied error. 

signInControl_Authenticate(object sender, AuthenticateEventArgs e)




e.Authenticated = true; //till this line  it worked success.

 base.RedirectToSuccessUrl(); //here it throws  :" Eror: access  denied "     current ly signed in user : myname sign is as   diuff. user


anybody knows how to overcome this , means authentication is  success, but authoriation didnt work.

 how can i get asuccessfull login to theweb appln/ siteccollection? in my role provder class i  have created my own roles

for user name: myname

role name:  Administrators, Contributor.

any help is appreciated





Sharepoint 2010 error on username in ASPX code


Here is the error:

Web page error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB6.6; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)
Timestamp: Tue, 2 Nov 2010 20:12:57 UTC

Message: Expected '}'
Line: 1076
Char: 440
Code: 0
URI: http://my.local.sharepoint2010server/Lists/TreatmentRoomB/calendar.aspx

I have reset the users profiles and even had the user use a different computer. here is what I think the deal is. Her last name is "O'Tool", and when the list is generating the calendar view it is freaking out... could it be the "'" in her name?

I have tried to go to the back end database and remove her, or at lease change the name.. but can't find the information.

the page works great for anyone else, even on the same computer?  



Finding username


Im running a query where it selects a property from the user with the matching username but i dont know how to find out the username of the currently loggedin user.

Please Help!

IsapiModule Error 500 Issue


I am about exhausted trying to figure out this error:

HTTP Error 500.0 - Internal Server Error

Description: The page cannot be displayed because an internal server error has occurred.

Error Code: 0x8007007b

Notification: ExecuteRequestHandler

Module: IsapiModule

Requested URL: http://localhost:80/ReportServer

Physical Path: c:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer

When I enable Failed Request Tracing Rules and view the log output I am supposing that the actual problem is in the 2nd call where there are 2 backslashes before the actual filename in the specified path:


CALL_ISAPI_EXTENSION DllName="C:\Windows\Microsoft.NET\Framework\v2.0.50727\\aspnet_isapi.dll"


Handling 404 page not found with Error page



      How do i handle 404 page not found?

Inserting personal error message in ValidationSummary



I am creating a web form that requires a lot of validation. I use many of the validation control in asp.net already like RequiredFieldValidator and CompareValidator. 

My Problem: after my custom validation for the value entered return an error message, and I pressed enter key when the field is empty, my custom error message is overlapped by my ValidationSummary. 

Setting my custom error to visible = false on button click also does not seem to work as it requires for me to enter the value first.

This made me think, is there a way to insert my custom validation inside the ValidationSummary as an error message like for other validation control?

Thanks in advance

Sys.Net.WebServiceFailedException: The server method '' failed with the following error:



Let's say we have 2 time consuming functions, aaa and aaa1 inside a aspx page.

        public static string aaa(int i)
            return i.ToString();

        public static string aaa1(int i)
            return i.ToString();



        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
        <span id="displayspan"></span>
        <br />
        <input type="button" value=

Jscript error: Object does not support property or method


 Hi, i have little knowledge on javascript but i need to use this code get from somewhere for a jquery to work.

I face this "Jscript runtime error: Object does not support property or method" whenever im trying to run this page.

In my experience, im get this error msg 9 out of 10 times i use javascript in my system.

Im using Microsoft Visual web developer 2008, i wonder if this is related to my problem, i not sure there is anything i need to add as reference or update anything.

But anyway, in short, i just couldn't use javascript code when using this development tool because of this sort of error.

Anyway, it happen that last time i tried use the same type of jquery code in another project and it seems to work well without an error.

But now when im try to use it again in this recent project i created, it come out with this error and i have no idea how to solve it even look through google and this forum.

It doesn't really seems like its the code problem itself although im not sure, because any javascript code just couldn't work.

So below is my code that i need to use.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript" src=&quo
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend