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

  • Home
  • SEARCH
  • 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 3854148
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:34:44+00:00 2026-05-19T17:34:44+00:00

In this hypothetical scenario there is an ASP.NET 4 web application that simultaneously aggregates

  • 0

In this hypothetical scenario there is an ASP.NET 4 web application that simultaneously aggregates data from multiple web services. The web services are all of the same implementation, but are separate instances and are not aware of each other.

In the web application a user provides credentials for each web service he wants access to, and the authentication process iterates through all of his user name/password combos coupled with the URL for each web service. (The clunky UI is for illustration only….)

Assume the web application uses the ValidateUser method in a custom MembershipProvider class for authentication, and the MembershipProvider is configured in web.config as per usual.

Assume also that the custom MembershipProvider class has a Url property that changes with each authentication call to the different web services.

Assuming all of that, how do you handle the scenario where User 1 and User 2 are authenticating at the same time, but User 1 has access to Web Service A, B, and C, and User 2 has access to Web Service X, Y, and Z?

Will the credentials and URLs potentially get mixed up and User 1 might see User 2’s data and vice-versa?

  • 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-19T17:34:45+00:00Added an answer on May 19, 2026 at 5:34 pm

    If you are going to implement a custom membership provider you will see lots of headaches down the road. The reason is that in your app model, the authorization scheme is based on whatever membership the user has (for a specific service).

    I would advise to have your own membership (for your own site) and extend the profile model so that you can retrieve credentials for each service that the user has access to straight out of the user’s profile.

    The profile information can be used in conjunction with your own authorization based on your own membership and role providers (specific for your site). In that case you can assign each user a role specific to each service.

    To successfully achieve that, for each service, write a wrapper, encapsulating service calls with your own methods (which call the service). This will allow you to mark your own methods with the [PrincipalPermissison] attribute… and achieve seemless authorization.

    So if your user has access to the Amazon web service and there are credentials for that service stored in his/her profile you can have the following:

    User Role: “AmazonAccessor”

    public AmazonServiceWrapper
    {
        [PrincipalPermission(SecurityAction.Demand, Role = "AmazonAccessor")]
        public void DoSomething()
        {
            UserProfile profile = UserProfile.Get();
            ServiceCredential credential = (ServiceCredential)(from c in profile.ServiceCredentials where c.ServiceName = "Amazon" select c).Take(1);
    
            if( credential == null )
                return;
    
            AmazonService amazon = new AmazonService();
            amazon.ClientCredentials.UserName.UserName = credential.Username; //coming from profile
            amazon.ClientCredentials.UserName.Password = credential.Password; //coming from profile
    
            try{
                amazon.DoSomething(); //wrap the amazon call.
            }
            catch(Exception ex)
            {
    
            }
        }
    }
    

    This will prevent you from having to juggle membership and all sorts of other headaches.

    Now to create your own profile you can do something like this:

    [Serializable]
    public class ServiceCredential
    {
        public string ServiceName { get; set; }
        public string Username { get; set; }
        public string Password { get; set; }
        public string ServiceUrl { get; set; }
    }
    
    public class UserProfile : ProfileBase
    {
        public static UserProfile Get(string username)
        {
            return (UserProfile)Create(username);
        }
    
        public static UserProfile Get()
        {
            return (UserProfile)Create(Membership.GetUser().UserName);
        }
    
        [SettingsAllowAnonymous(false)]
        public List<ServiceCredential> ServiceCredentials
        {
            get
            {
                try
                {
                    return base.GetPropertyValue("ServiceCredentials") as List<ServiceCredential>;
                }
                catch
                {
                   return new List<ServiceCredential>();
                }
            }
            set
            {
                base.SetPropertyValue("ServiceCredentials", value);
            }
        }
    }
    

    And of course the Web config:

    <system.Web>
    <profile 
       inherits="MyApplication.UserProfile" 
       defaultProvider="AspNetSqlProfileProvider">
       <providers>
          <add 
              name="MyProfileProvider" 
              type="System.Web.Profile.SqlProfileProvider"
              connectionStringName="MyConnectionString"
              applicationName="MyApplication" />
       </providers>
    </profile>
    <system.Web>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a bit hypothetical and grossly simplified but... Assume a program that will
This past summer I was developing a basic ASP.NET/SQL Server CRUD app, and unit
This is a hypothetical scenario. Let's say you've just been hired at a company
I have the following (hypothetical) scenario: Application to report on students in classes in
This is a bit of a hypothetical question that has sent me off down
This is all hypothetical, so please bear with me. Say I'm writing a tool
This is my first post here and I wanted to get some input from
I'm not actually writing this software myself, but it occurred to me that I
Ok, this is rather simple, but from what I've seen… you can only use
In a web application like wiki or forums or blogging software, it is often

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.