Identity Server Site Origin

Viewed 63

I have implemented identity server using an asp.net core mvc site. Everything is working great with one exception. My business would like to add a welcome message to the login screen that changes depending on where the user is logging in from. If for example a user comes from "https://dev.website.com" then the message "Welcome Developer" should be displayed on the login page. Coming from "https://test.website.com" would result in the message "Welcome Tester" being displayed. The question is, how can I identify where the request originated from? I somehow need to identity that a user is logging in from "https://dev.XXX" or "https://text.XXX" but I can't figure out how.

Any help would be greatly appreciated.

Thanks

1 Answers

The http request you receive contains two headers with the address you want. Try to check the "Origin" and/or "Referer" headers.

string referer = Request.Headers["Referer"].ToString();
Related