Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use ASP.NET forms authentication in Postman

I'm currently working on migrating an ASP.NET Web Forms website to have an API so that it can have a React front end.

I'm going to continue to use forms authentication to begin with for this migration, but would like to know how to POST on the login form (/login.aspx) from Postman so that forms authentication works and logs me in so I can then proceed to test the APIs I write. I'm using the standard ASP.NET web forms login control.

I've tried using this (https://www.youtube.com/watch?v=B4ilccLUQVs) method, which seems to at least get me the POST data I need I suppose, but there seems to be something missing as I'm being redirected to login.aspx in Postman and any calls to the API still ask for authentication.

I did notice it invokes some javascript method called WebForm_DoPostBackWithOptions in the onclick event handler when the login button is pressed, but I'm not sure how I'd invoke this in Postman.

If anyone's done this already, I'd be glad to heard from you!

like image 927
Frank Tzanabetis Avatar asked Oct 26 '25 20:10

Frank Tzanabetis


1 Answers

You need Postman Interceptor and Interceptor Bridge to capture the forms authentication cookies to authenticate your Postman POST/GET requests. You would also use Interceptor to capture and save your Google Chrome browser API requests in a Postman Collection.

Copy and Paste steps from Postman Community: Source

Requirements

  • Postman Interceptor (v0.2.26 and above): https://go.pstmn.io/interceptor-download
  • Postman App (v7.2.1 and above): https://www.getpostman.com/downloads/
  • Interceptor Bridge
    • OSX
    • Windows
    • Linux

Quick Start

Run the install script from the OS-specific Interceptor Bridge package. Do not change the location of the com.postman.postmanapp.json file after executing the install script. Depending on your OS, you might need to double-click or execute the installer script via a shell. Users on MacOS/Windows might see a security warning. For example, to override the security on MacOS, you may need to right click > open.

Restart Chrome (only required for Windows)

Update the Postman Interceptor Extension to v0.2.26 or above (chrome://extensions/ > enable Developer Mode > Update).

Update Postman to v7.2.1 or above.

Open the capture cookie overlay from the icon on the top-right.

enter image description here

The ‘Interceptor Connected’ status indicates that Postman is able to communicate with the Interceptor extension installed in the browser.

Enable the Capture cookies setting, and add domains you want to sync cookies for.

Additional: source

like image 164
SimplyInk Avatar answered Oct 28 '25 16:10

SimplyInk