Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6082259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:16:10+00:00 2026-05-23T11:16:10+00:00

I am using this code in a SharePoint web part, that checks if a

  • 0

I am using this code in a SharePoint web part, that checks if a user is in a role (for Forms Based Authenticated sites).

foreach (string role in System.Web.Security.Roles.GetAllRoles())
  foreach (string user in System.Web.Security.Roles.GetUsersInRole(role))

I then compare usernames for the existing users in the role, and the username (as a string) I am trying to authorize. And it works fine, as expected, as long as the Role provider is setup for the web application.

However, I also have a timer job that is used to process incoming emails sent to the smtp server and relayed locally to the smtp drop folder (C:\inetpub\mailroot\drop). The timer job then reads the email from the drop folder, and parses/processes it. To identity the user sending the email, I take the “from address” and do a lookup to the sharepoint site to get the user’s identity using SPUtility.

But, I need to check if the user is in a role specified by that web site’s FBA Role Provider. The role provider details are black box, unknown and can be changed at run time, so I have to use the role provider built-in functionality, ie. Roles.GetAllRoles, Roles.GetUsersInRole(x). (I can’t go directly to the database or other behind the scenes data source). I do however know the address of the website that I need to authorize the user against from the job timer.

But, System.Web.Security.Roles.GetAllRoles() is not accessible to the job timer because its not an asp.net web application (actually part of the OWSTIMER.exe windows service).

So, How do I check if a “loginname” is a member of a Role from within a Job Timer?

NOTE: This question could also be asked completely leaving SharePoint out, and assuming that I want to check a “loginname” from within a Windows Service or WinForms Application. I basically need to check if a user is in a FBA Role (RoleProvider specified in an asp.net 2.0-3.5 web application’s web.config settings), from a source that is not the windows application where the role provider is defined and accessible.

Also, I can’t use a web service since the goal is to only have a SharePoint Web Part and SharePoint Job Timer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:16:10+00:00Added an answer on May 23, 2026 at 11:16 am

    You’re not specifying your SharePoint version, so I’ll assume you’re talking about SharePoint 2007 here. However, the same principle would apply to SharePoint 2010.

    The OWSTIMER.exe file is stored in 12hive\bin. You can create an OWSTIMER.exe.config file in the same folder and register your role and membership providers in that file the same way you would do it in a web.config file.

    For an example, take a look at this article http://msdn.microsoft.com/en-us/library/bb977430(v=office.12).aspx (the interesting part is in the topic ‘alerts’)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this code, and I get the stack trace that is listed below.
I am inserting a list item using sharepoint web services.... Here is my code:
I'm using SharePoint web services in C#. I have my code working to check
I'm using Javascript inside of a SharePoint 2010 Content Editor Web Part to insert
I have an issue in my SharePoint environment and I suspect that this code
Using this code to zip a folder and it works perfect on small files
Im using this code for mysql connection $con = mysql_connect(localhost:/var/lib/mysql/mysql.sock, abc , xyz); if
While using this code to serialize an object: public object Clone() { var serializer
When using this code (simplified for asking): var rows1 = (from t1 in db.TABLE1
Im using this code: $(this).css('backgroundcolor', localStorage.getItem('bgColorr') + !important;); When i write: alert( localStorage.getItem('bgColorr') +

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.