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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:35:52+00:00 2026-05-20T06:35:52+00:00

Firstly, please don’t dismiss this question – I’m aware it’s an ugly situation but

  • 0

Firstly, please don’t dismiss this question – I’m aware it’s an ugly situation but hey, real life isn’t pretty.

I’m developing an extra section to a web app that’s written in asp.net, but in php – it’s mostly done (the two parts don’t really communicate with each other outside of a database – the integration is mostly just cosmetic.)

The only issue I have is detecting from the php part when the .net session has expired so that it logs the user out and redirects to the login page.

I believe the asp.net application is compiled, but either way I’m not allowed to alter it so I was thinking maybe the best thing to do would be to make a very small/simple aspx page that outputs true or false which I could call using curl from php (and passing the browser’s cookies along.)

Would this even be possible? I’m not sure how session security works on asp.net eg whether one .net application can read another’s session variables, but if it’s anything like php then it’ll be possible.

mypage.php --curl--> checksession.aspx --|
|                                        |
<----------- true / false <---------------

So mypage issues a GET (with cookies from browser) to checksession using curl, checksession simply returns a true or false (or something like that) and mypage redirects to the site’s login page if that’s false.

The authentication for the php side is already sorted out and is separate to this issue.

So really, what I need to know is can I have just a simple .aspx file that does this check, and if so where would I go to to find out how to program such a simple page? If it’s just a line or three, please could you let me know what those lines would be (I’m sorry I’ve never done any .net stuff..)

If this isn’t possible, then if you don’t mind, could you provide some alternative solutions? Thanks!

— EDIT —

After spending most of the day with this problem, I’m now thinking that using php at all to get around this is a bad idea. There’s actually two levels of authentication involved (one is normal HTTP request/response login type thing, then there’s the .net session) – on top of that I totally missed the point that obviously these sessions are almost certainly going to be backed up by the IP of the users browser which I’d have to spoof or something coming from curl as that’ll be running on the server.

So I think I’m going to use jQuery somewhere in the header of my page to check and redirect as required…somehow :/

— EDIT 2 —
Ok, so the javascript way has suited my needs pretty well – obviously it’s not a secure way of doing things, but fortunately in this case it’s ok as this is just an app used on the intranet (and the shoddy way they authenticate users is terrible anyway.)

  • 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-20T06:35:53+00:00Added an answer on May 20, 2026 at 6:35 am

    There are multiple ways here. First of all, the cookies alone won’t do much, because the session can be expired in ASP.net even though the Cookie is still alive.

    ASP.net supports multiple SessionStates, of which two are common:

    1. In Process – here, the Web Server (Usually IIS) holds all Sessions in memory. If the IIS Service is restarted (Happens by default every 24 hours, not just when the system restarts!), All Sessions are wiped (that’s why the cookie alone does not help). This scenario is default I believe and thus very common in single-server environments
    2. SQL Server – here, the session data is stored in a SQL Server database. This isn’t used that often though.
    3. State Server. This seems really uncommon, so I’m omitting it.

    Scenario 2 is your best bet, because you can just read the session id from the cookie and query the SQL Server database for the session info.

    in Scenario 1, your approach is the correct one: You need help from the ASP.net Application, which can be a .aspx page. Make a request from PHP passing in the session cookie and check Session.SessionID and Session.IsNewSession to make sure the ID Matches and IsNewSession should be false – otherwise, ASP.net just recreated a new Session.

    You may have to interact with the Session from the ASP.net page to activate it (Session["PingFromPHP"] = true) which may interfere with the ASP.net Application if your key (the name in the []-brackets) has the same name.

    If the ASP.net Application is compiled, put the .aspx.cs file that serves as the code behind into a folder named App_Code, this should allow you to run it.

    Hope that gets you started.

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

Sidebar

Related Questions

Firstly, please don't move to serverfault. It is indeed a programming question :-) We
Firstly, This might seem like a long question. I don't think it is... The
Firstly, this DB question could be a bit DB agnostic, but I am using
Firstly, Real World Haskell , which I am reading, says to never use foldl
This post might be a bit long, but if you think you can help,
I am going to ask you this question here since I cannot find answer
Ok firstly, this is not a discussion on whether I should be catering for
Could you please explain me the logic of UNIX signal system: firstly it sends
Firstly, I'm totally javascript inept so please explain throughly. OK, I have two issues
Firstly, Happy New Year everyone. I'm new to Rails, so please tolerate any incorrect

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.