ASP.NET使用基本身份验证重定向到网站 [英] ASP.NET Redirect to website with Basic Authentication

查看:123
本文介绍了ASP.NET使用基本身份验证重定向到网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想重定向到另一个具有基本授权的网站(弹出询问用户名和密码)

对我来说,我知道授权标头内容,就像
授权:Basic trityrkyjhtjyrtytrtytry ==,Base64加密用于"username:password"加密.结合使用,我正在寻找的是从服务器端(ASP.net C#)重定向到网站URL,并传递身份验证标头以自动登录到网站.

是否可以通过任何方式传递标题和重定向,而无需弹出窗口询问用户名和密码.

这是2个门户之间所需的单点登录机制.

在此先感谢

Hello,

I''d like to make a redirect to another website which have a Basic Authorization (pop up asking for username and password)

for me i know the authorization header content which is like
Authorization:Basic trityrkyjhtjyrtytrtytry== , the Base64 encryption is for the "username:password" combination, what i''m looking for is to redirect from the server side (ASP.net C#) to website URL and pass the authentication header to auto login to the website.

is there''s any way to pass the header and redirect without popup asking for the username and password.

this is single sign on mechanism needed between 2 portals.

Thanks in advance

推荐答案

第一件事,如果您对多个门户网站或网站有单一登录要求,那么最好使用Out-Proc状态管理设计在状态服务器或数据库服务器中保存用户会话.

如果您正在寻找解决问题的快速方法,请阅读以下内容.

代替使用登录页面登录,而是使用编码后的查询字符串参数重定向到登录/主页.
设计接收页面以解码提供的那些参数,并将其转发以进行身份​​验证.
使用用户控件或母版页在每个页面中应用会话验证逻辑.
如果会话可用于用户参数,则继续导航到登录/主页或其他页面.
如果会话不可用且用户参数有效,则在该门户上为用户创建会话.
如果用户参数无效,则重定向到身份验证错误页面.

这可能是合乎逻辑的方法,为了获得更好的结果,可以寻求最佳实践和更好的设计标准.
First thing, if you are having single sign-on requirement for multiple portals or websites, then its always better to have Out-Proc state management design to save user sessions, at state-server or in db-server.

And if you are looking for very quick fix to your problem then read below.

Instead of using log-on using login page, redirect to landing/home page with encoded query string parameters.
Design the receiving page for decoding those provided parameters and forward them for authentication.
Apply session validation logic in each page using user control or master page.
If session is available for user parameters then continue to navigate to landing/home page or other page.
If session is not available and user parameters are valid then create session for the user on that portal.
If user parameters are not valid redirect to authentication error page.

This can be the logical approach, for better results go for best practices and better design standards.


这篇关于ASP.NET使用基本身份验证重定向到网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆