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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:08:10+00:00 2026-06-01T02:08:10+00:00

I need to realize a following authentication on my asp.net: the user on the

  • 0

I need to realize a following authentication on my asp.net: the user on the ASP.NET and PHP websites should authenticated using the OpenID. The login and registration exists only on the PHP website. SO the requirements are:

  • My ASP.NET website should redirect to the PHP website for the authentication. The user will
    authenticated using OpenID from the PHP website.
  • If the user is new (I plan to use a coookie) to my ASP.NET website, it will redirects with empty
    paramater. Otherwise, I pass a stored OpenID in the redirect request.
  • The PHP website shows the user the login page if the passed OpenID is empty and allows the user to authenticate and register himself. If the passed OpenID is not empty. the PHP website should check its valid state.
  • Only if the authentication / registration succeeded the PHP website redirects back to my ASP.NET website the OpenID, that I will use for the user.
  • This process, of course, must be secure.

I found that the check for the authentication should be implement in the Global.asax in the Application_AuthenticateRequest event using the FormAuthentication. I plan it like this

protected void Application_AuthenticateRequest(Object sender, EventArgs e) {
  if(HttpContext.Current.User != null) {
    // Extract the forms authentication cookie if exists.

    // Redirects to the php website using the OpenID extracted from the cookies, or empty.
    // Pass also a new generated token to secure the communication.

  } else {
    // Store a new GeneralPrincipal to the HttpContext.Current.User.
  }
}

protected void Application_BeginRequest(Object sender, EventArgs e) {
  // Check for the redirected back token and OpenID.

  // Create FormsAuthenticationTicket for the openid and store it in the cookie.
}

The problem is, that I can’t save the generated token in the Session, because the SessionState is not initialized at the time.

Which is the best practice to solve the requirements above?

  • 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-06-01T02:08:11+00:00Added an answer on June 1, 2026 at 2:08 am

    I’ve solve the problem by using the base page class for all my sites that should be protected. The user will be checked in the OnInit on every request like this

    protected override void OnInit(EventArgs e) {
    // Check Identity.
    if(HttpContext.Current.User.Identity.IsAuthenticated) {
      // The user is already authenticated.
      // Get the user...
      return;    
    }
    // Check if the php server sends request with token.
    if(!string.IsNullOrEmpty(Request.QueryString["token"])) {
      try {
        // Get user from the PHP-Server by the token.
        //...
        // Remove old FormsAuthentication.
        FormsAuthentication.SignOut();
        // Save new authentication.
        SaveAuthentication();
      } catch(Exception exception) {
        // Handle...
        return;
      }
    } else {
       // Get new php-token and redirect to the php-server for the authentication.
       //...
    }
    

    For the localizable ASP.NET web sites it can be implemented in the InitializeCulture method.

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

Sidebar

Related Questions

REVISED QUESTION I realize using the response to: $facebook->api('/me?access_token='.$access_token) will determine whether you need
I get the following exception when trying to load an ASP.NET MVC website: Unhandled
I need to realize a complex if-elif-else statement in Python but I don't get
I realize that I need to use a mailserver so people can contact me,
Developing a project of mine I realize I have a need for some level
Using visual studio 2008, I had a solution open and realized I need to
I need to build an NSString that resembles the following: Name: Craig Buchanan Telephone:
I wrote the following pre-commit script for SVN to validate that a user has
I need to verify if a string is in the following format {x:y} or
I had a need to do a case insensitive find and found the following

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.