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 259813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:17:44+00:00 2026-05-11T22:17:44+00:00

For my web app security I’m using FormsAuthentication / MembershipProvider with a non persistant

  • 0

For my web app security I’m using FormsAuthentication / MembershipProvider with a non persistant cookie.

My application interacts with some web services, these also use the Membership providers.

User passwords are hashed in the database.

The problem is the person logged into application the web service needs to authenticate with the web service using his username and password every time a page is loaded. BUT once the user has logged in his password is not retreivable as it is hashed.

I was wondering if the password could be stored securley in the Authentication cookie so that the user can authenticate with the web service.

Or a better idea!

EDIT
I LIKE JOHNS IDEA BELOW BUT HAVE 4 COMMENTS ON THE MECHANICS THAT I WANT TO RESOLVE BEFORE GOING DOWN THAT ROUTE…

  • 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-11T22:17:44+00:00Added an answer on May 11, 2026 at 10:17 pm

    I agree with @John’s answer that using throwaway token is better than storing the credentials.

    For the token you could generate some random GUIDs and store it in the database.

    As an alternative that does not require coordination between your ASP.NET application and the WCF service, you could send a signed document as token.

    1. create an XML or JSON document with signed time, user name, and signer’s name (ASP.NET app).
    2. generate a hash of the above document.
    3. sign the hash using asymmetric encryption (use private key).

    All WCF has to do is validate the hash and the signature. So this does not involve hitting the same database. Using the signed time, you can expire the token in fixed time.

    Edit: The idea is based on public-key cryptography (also known as asymmetric key algorithm, public/private key). If you encrypt something with a private key you can decrypt it back only using the corresponding public key; and if you encrypt something with a public key you can decrypt it only using the corresponding private key. See Implementing RSA in C# for how code would look like in C#. Why is this useful? Because we can use this to implement digital signatures. A digital signature is a way to prove that I and only I wrote something, and no one else.

    Following the above mentioned step generates a signature. You first need to define a canonical form of “let this guy in” document. Usually an asymmetric key algorithm can’t handle too big input, so you generate a hash out of it, and you encrypt the hash using your ASP.NET application’s private key. The resulting signature can only be decrypted using you application’s public key. Finally you can package all three components (original document, hash, and signature) into some format like XML or JSON and send it as token.

    As an example, let’s say you use JSON format for everything. First, the original “let this guy in document”:

    {"UserName":"Foo","SignedTime":"2009-07-09T00:00:00","Signer":"ASP.NET APP1"}
    

    Next, you generate a SHA-1 hash of the above string, which is byte[] and encode it with modified Base64 encoding or something, which would look something like:

    b2YgYW55IGNhcm5hbCBwbGVhc3VyZS4 
    

    The above is bogus string, the actual stuff may look longer. You then take the hash byte[] and encrypt it using RSA, which generates another byte[] so encode that too with modified Base64:

    mxlIGdlbmVyYXRpb24gb2Yga25vd2xfo34
    

    Finally, you make another JSON document to store all the above.

    {"UserName":"Foo","SignedTime":"2009-07-09T00:00:00","Signer":"ASP.NET APP1","Hash":"b2YgYW55IGNhcm5hbCBwbGVhc3VyZS4","Signature":"mxlIGdlbmVyYXRpb24gb2Yga25vd2xfo34"}
    

    The final JSON document becomes your passwordless token. Pass it to WCF service.
    The WCF service takes the token, construct the original document by removing the hash and signature:

    {"UserName":"Foo","SignedTime":"2009-07-09T00:00:00","Signer":"ASP.NET APP1"}
    

    Follow the same algorithm to generate the hash and verify it’s the same. Decrypt the Signature using the public key of the ASP.NET app and see if it becomes the hash. At this point, the document is verified to be signed by the signer. Check the current time and the signed time and see if the token is still valid. All you need is a way to distribute public keys between two code base, which could be loaded from XML.

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

Sidebar

Ask A Question

Stats

  • Questions 118k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Is this what you are looking for? item.File.ServerRelativeUrl or if… May 11, 2026 at 11:31 pm
  • Editorial Team
    Editorial Team added an answer There's also 'paredit. The cheat sheet shows you all the… May 11, 2026 at 11:31 pm
  • Editorial Team
    Editorial Team added an answer From the sounds of it you may be (a) running… May 11, 2026 at 11:31 pm

Related Questions

For my web app security I'm using FormsAuthentication / MembershipProvider with a non persistant
I am trying to install an app inside of another web app. I have
I am trying to setup windows server 2008 smtp server to relay emails to
I have a project with two silverlight apps (foo1 and foo2) and an ASP.NET
I'm wanting extra security for a particular point in my web app. So I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.