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

匿名 (未验证) 提交于 2019-12-03 08:57:35

问题:

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

回答1:

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.



回答2:

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).



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!