Srikanth Venugopalan
Srikanth Venugopalan

Reputation: 9049

Pass value from one ASP.NET app to another via HTTP Header

We are implementing a single sign on mechanism in an enterprise environment, where the token is shared between applications using HTTP header. Now, in order to do the integration test, I need to write an application to simulate this.

Is there any way in ASP.NET where I can redirect to another web-page and pass a custom HTTP header in the process?

Thanks

Upvotes: 3

Views: 4863

Answers (2)

bleevo
bleevo

Reputation: 1667

You need to create a page on Site B that Site A redirects the user too that sets a cookie with the desired value.

for instance.

http://siteb.com/authenticate.aspx?authtoken=15128901428901428904jasklads&returnUrl=http://siteb.com/index.aspx

authenticate.aspx would set a cookie and then every request would receive authtoken.

Upvotes: 2

umbyersw
umbyersw

Reputation: 615

The server could send the HTTP header to the client on a redirect, but the client would not send it back to the other remote server.

The ideal solution in this case would be to use a Cookie, or a QueryString variable. Cookies may suffer from cross-domain issues and become complicated if host names are different enough.

In any of these approaches, one must be careful not to create a security hole by trusting this information as it is user input coming back from the client (or some black hat).

Upvotes: 0

Related Questions