.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

Deactivating a user roles automatically when email activation is clicked

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :ASP.Net

 Hi I know this is a simple fix but here's my register.aspx.vb and activation.aspx.vb codes. Its given an ordinary user unauthorized permissions after activation from email link which when clicked, approves and logs them in.


Protected Sub RegisterUser_CreatedUser(ByVal sender As Object, ByVal e As EventArgs) Handles RegisterUser.CreatedUser


    If _group IsNot Nothing Then

      Dim mp As ******WebMembershipProvider = CType(Membership.Provider, ******WebMembershipProvider)

      Dim user As MembershipUser = Membership.GetUser(RegisterUser.UserName)

      mp.AssociateUserWithGroup(user, _group)


      Dim cuw As CreateUserWizard = DirectCast(sender, CreateUserWizard)

      Dim userId As Guid = DirectCast(user.ProviderUserKey, Guid)

      Dim EmailMsg As New System.Net.Mail.MailMessage("inquiry@*******.com", RegisterUser.Email)

      EmailMsg.Subject = "Email Verification from ******.com"

      EmailMsg.IsBodyHtml = True

      EmailMsg.Body = "T

View Complete Post

More Related Resource Links

SPD workflow doesn't send email to user in list when automatically started

Hi all,

My first post here and I hope someone out there could kindly help. I recently found out a strange issue with my SPD workflow. Basically, it couldn't send out email if (1) the recipient resides in the list and (2) the workflow is automatically started.

For example, I have a list with a "user" field. A workflow first "Send an email" to this user, and then "Collect data from a user" from this user. If the workflow is set to start automatically, then this user gets no email. Tasks list does contain a task, but the "Assigned To" field of the task is empty. This is the case no matter if the user field is of type "Single line of text" or "Person or Group".

Everything's fine if I manually start the workflow. And everything's fine if the user is directly spelled out (jay@company.com) in the "Send an email" and "Collect data from a user" actions instead of retrieved from the list. Either case the user would get two emails as expected, and the "Assigned To" field would display the user name properly.

I looked into the log but didn't find anything special. As you can imagine, this is breaking a lot of our workflows and making SPD workflow look very bad. It's just not

Linq - add data to database then email user the details


Hi all

I'm not sure how to structure the code for this but what I want to do is be able to add data to a database, and once this has completed successfully, then email the user to say the details have been added successfully to the database.

I need to:

1. Check that the relevant data has been added into the database then

2. Email the details of the relevant data when completed. 


Thanks in advance for your help,




Fetching the Currently Logged in user Email


Hey Frnds,

I am using the System.DirectoryServices.UserPrincipal.Current.EmailAddress to fetch the Currently logged in users email from AD.

If  debug my sol am getting the Exact mail id of that Particular user for ex:john@in.domain.com.

If i host My Application on iis

And Access my App am getting some other Email id instead of the john@in.domain.com.

I have changed the Application Pool identity to NetWorkService.

Can any one tell what could be wrong




Adding user to certain roles


I have setup ASP security in my application. I used the following tutorial, just wondering if someone can tell me how i can setup this up to allow the creation of a user?


Can someone tell me where to find or what to search on to find some example of how to add the option for adding users?

I have the above setup and its working, but only because of the accounts i created with my global.asax file.
I need to give the admins access to add a new user. Currently i can search on existing users and update them, but need to add the ability to add a new user.

Send an Email with User fields data entered in the form


Hi All,

          I have a form which have some user input fields(like textboxes,dropdownlists,textarea etc) fields and a submit button.

on click i need to send email with body contents as all the details entered by user in the form

Can anyone suggest how i should approach to this in sharepoint..

any code examples would be appreciated.


[Sharepoint 2007] How can i change the email of a sharepoint user ?

Hi all,

I have created a new sharepoint user.

1. First of all i have added a new user in active directory. However at that time i forgot to give an email address. Big mistake !

I cannot send mail from sharepoint workflow with the new user.

2. Therefore I updated the email addresd in active directory afterwards. But the change was not reflected in sharepoint.

I updated the mail in sharepoint adminsitrative user profile. But it did not make no difference in the user moss profile.

I followed the article in http://sharepointnotes.wordpress.com/2008/05/05/syncing-wss-and-moss-user-profile-properties-with-active-directory/

I did the following commands :

1. stsadm -o sync
2. stsadm -o sync -synctiming m:2
3. stsadm -o sync -deleteolddatabases 6
 stsadm -o sync

None of these commands updated the user properties mail for my new MOSS User.

I also rebooted the machine but my MOSS user email was not updated.

Also I used the tool at http://userprofilesync.codeplex.com/releases/view/13227
like the following :

tool>UserProfileSync.exe -url http://mysite -ssp http://mysite:37239/ssp/admin
I did not make any difference

What else can I try in order to update the email of my MOSS user ?

How to change The DateTime Automatically according to User TimeZone Offset?

I have an application in which we are displaying DateTime in many pages. we want to display these DateTime's according to UserTime zone. UserTimeZone will be in database. All DateTime values will be saved int UTC format. My Requirement is I want set the TimeZoneOffset of user in ServerSide based on the User TimeZoneOffset All the DateTime values needs to be Added/Substracted while showing the DateTime values to user. I dont want to manully add/substract TimeZoneOffset value in all pages. Is there any way the DateTime  automatically change to the User Timezone.  How can I do this? Thanks in Advance ChellamNaidu

Need Form Application to allow user to review spreadsheets and email

I need an application to allow a user to see a list of documents/spreadsheets in a directory, click a link to the file, have it open, then review it, close it, then from the form choose to accept or deny it, then have it emailed to a recipient contained in a db or list any good ideas how to accomplish this?  maybe a windows form?    

Task assignment to user without read access in 2007 results in no email to assignee, no warning to a

It appears (from observation and searching) that SP 2007 will not send a task assignment email when the assignee does not have read access for the assigned task and there is no warning when assigning a task to someone who will be unable to read it. I have not been able to find any mentions of attempting to address this quirk by either an item event listener or a workflow that would either prevent the assignment or task the originating user to fix the issue by either changing the assignment or having them added to the appropriate group.  I could see one done badly causing a cascade of tasks. The approaches that I've thought about are: Attempt to block assignment by hooking ItemAdding and ItemUpdating on the task content type.  In ItemUpdating, you could use SPListItem.DoesUserHavePermissions since the SPListItem should be there, but you'd may have check the list since I don't think SPListItem is available at that time.  I could see this causing problems when the assignment is via workflow or something that doesn't like other code interfering with its task creation. Hooking ItemAdded and ItemUpdated to assign a new task to the assigning user to either change the assignment or have the assignee added to the users with access to the site. Define a workflow which could be enabled for a list that would check if any new or modified task is assigned to users with

Checking SQL Server User Roles and Creating SQL Server Users using VB.NET

Hello gurus!Firstly I want to apologies if this question is out of place here.. if someone can direct me to the correct forumn great and Thanks!I have a VB.NET application which uses its own Backend Database (MSSQL Server). I need to distribute this application to sites where there will be an existing SQL Server.So I will need to Create the Database on this server. The Application includes methods for building the database on startup if not already connected to one.However the users windows logon may not have the correct permission to connect and create a Database on the Server. I have a DB Setup form in my application which asks for the Servname, Username, Password and Database name. I have catered for Windows Authentication and SQL Server Authentication within the form - the user makes the choice.Assuming they enter a Username and Password for SQL Server Athentication then I will be trying to connect using this user and create the database on the given server. The following is my outline logic:-                                                                  Create db Process                                                                             |                                                                             |                                                               Check Credentials                                                                   / 

AUTOMATICALLY send an email on a future date

HiI would like to achieve the following. 1- if a user goes to a web page in a web application hosted on the Internet and selects a FUTURE date from a "Calendar control" the date selected and the URL for the page are stored in the database (I know how to do this step) 2- when the date selected arrives the URL will be embedded in an email that is sent out AUTOMATICALLY to the user. How can I trigger the email to go out AUTOMATICALLY on the selected date?????? Does the link below help me answer this question??  I just need a high level steps on how to do this. Your help is greatly appreciated. http://msdn.microsoft.com/en-us/magazine/cc163821.aspx

Is it possible to display the friendly name or email address of LiveID User Using Claims Authenticat

We have finally gotten LiveID authentication to work.  However when we specify a user to add to a sharepoint group, we need to do it via the unique id that live uses.   The user does login using their usual email address and password, but on the sharepoint side they see the PUID@live.com as the logged in user, and when we want to specify the user to have access to the a particular site or library, we have to do it by the same PUID@live.com.  This display makes it difficult to manager users on the sharepoint side.   Is there something I missed on setting up of the authentication provider, or is there something I can do to get sharepoint to retrieve the other information so that we can view the user through the email or full name that live provides?   Steve Paplanus

Redirect to specific page based on user Roles

I am using Formsauthentication. My situation is as per below:the login form has codebehind :==============================protected void LoginButton_Click(object sender, EventArgs e)        {            TextBox uname = Login1.FindControl("UserName") as TextBox;            TextBox pass = Login1.FindControl("Password") as TextBox;            CheckBox rm = Login1.FindControl("RememberMe") as CheckBox;            Literal fail = Login1.FindControl("Literal1") as Literal;            if (Membership.ValidateUser(uname.Text, pass.Text))            {                /                FormsAuthentication.SetAuthCookie(uname.Text, rm.Checked);                            }        &

SharePoint 2010 email enabled list with workflow has incorrect User ID when items are emailed to the

I have set up an approval workflow for a document library that has email enabled. Emails come into the document library fine, however, if an item is emailed to the library the workflow kicks off with the initiator as "System Account" rather than the person who submitted the email. This makes the error of "The e-mail message cannot be sent. Make sure the e-mail has a valid recipient." come up. If someone submits a document directly to the library (by logging into sharepoint and submitting) everything works fine. The person submitting by email is a valid sharepoint user and the profile shows the correct email address. The Created by and Modified by fields show the correct person (rather than System Account), it's only the workflow User ID that shows incorrectly if document is emailed to library. Any help or ideas would be appreciated. Thanks

User access stripped automatically on subsites

Hello, I create a subsite, select  "use unique permissions", and create the accessgroups: visitors, members and owners.  I then enter som testusers in the visitors and members-groups, log on as them to make sure the testusers have the correct access-levels.  I also make sure my newly created access-groups are the only groups with access to the subsite.  20 minutes later, the testusers no longer have access to the subsite.  What kind of service running on the server would strip these rights?  When I log on with the owner-account, I can still see the testusers in the correct groups, but they no longer have access. I'm hoping for some good suggestions! Thanks, Kjersti

Use of aspnetdb configuration for user login,roles and all



I created a web application and i created the users,roles and all using the asp.net configuration,

the aspnetdb is created and i include that in my project adn run it it works fine.

then i copy the whole folder in my root folder of my IIS and it works perfectly fine

Now if i want to create the whole project into an exe such that  if i run the exe on a system that has iis on it,it should automatically create the virtual directory and i shud be able to run it from the new server.

i tried it but the login is not working,

Can you help me finding out the exact way in which i can create the login features using the asp.net configuration.

How to get Email of Current User Data View Web Part Sharepoint 2010 and pass to WebService data sour

I have to pass in the email address of the current user to a web service data source (run time) of a Data View Web Part.

My Question is:

a) How can I get Email address of current user based  in DVWP.
I know we can get the CurrentUser using the CurrentUserName but how do we get the Email for the Current User.

b) After getting the Email how do we pass to the Web Service.

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