重定向到带有用户名和密码的链接 [英] Redirect to a link with username and password

查看:146
本文介绍了重定向到带有用户名和密码的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我在一个窗口中有3个iframe. 3帧会命中3个不同的URL.在3个网址中,有2个将点击一个要求输入用户名和密码的链接.因此,我想将用户名和密码以及这2个链接一起传递,这样它将在不要求用户名和密码的情况下打开主页.并且详细信息对用户不应该是可见的.

Hi All,
I have 3 iframes in a window. 3 frames will hit 3 different URLs. Out of 3 urls 2 will hit a link which asks for username and password. So, i want to pass the Username and password along with those 2 links, so that it will open the home page without asking for the username and pwd. And the details should not be visible to the user.

推荐答案

您可以使用Cookie.

You could make use of cookies.

//writing a cookie
HttpCookie myCookie = new HttpCookie("MyTestCookie");
DateTime now = DateTime.Now;
// Set the cookie value.
myCookie.Value = now.ToString();
// Set the cookie expiration date.
myCookie.Expires = now.AddMinutes(1);
// Add the cookie.
Response.Cookies.Add(myCookie);
Response.Write("<p> The cookie has been written.");

//reading a cookie
HttpCookie myCookie = new HttpCookie("MyTestCookie");
myCookie = Request.Cookies["MyTestCookie"];
// Read the cookie information and display it.
if (myCookie != null)
   Response.Write("<p>"+ myCookie.Name + "<p>"+ myCookie.Value);
else
   Response.Write("not found");


这篇关于重定向到带有用户名和密码的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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