发信人: dega.p()
整理人: kamkam(2002-05-01 23:46:36), 站内信件
|
我们知道在Web应用中,一旦我们曾经输入过一次用户口令,那么,系统
将会一直使用当前Web用户与Domino HTTP服务器连接。如果我们希望
以另一名Web用户访问此服务器,只好关闭浏览器,再重新连接服务器
时,重新输入其他用户的名程和口令。(这是我们不愿意作的。)
如何不关闭浏览器,强迫浏览器显示登陆窗口呢?
关于如何强迫一个Web用户输入登录口令的方法,在此列出两个:
1。Java Servlet程序
2. Domino URL 命令
这两种方法都是强迫浏览器显示登陆窗口,以使用户可以其他用户名登陆。
实际上不能注销当前已连接Web用户,除非在登陆窗口输入错误的用户名和
口令或者不同于当前已连接的Web用户的正确的用户名和口令。
注释:这段程序有一段逻辑错误,本人已经对其更正
这段程序可以使用Domino URL命令代替,功能完全相同。在R5中试验可行,4.6估 计可行。
比如:http://host/anydatabase.nsf?login
注意这里一定要写一个数据库的名字,可以是任何一个数据库,
甚至是不存在的数据库。请注意格式。
你可以试试,有结果您可以写信给我。
-------丁香书 1999.8.13
=====================================
问题5:怎么使一个Web用户注销登录?
来自:http://dingxiang.163.net
更新:1999.8.14
解答:
How do you add a logoff button for web users?
Using the username:[email protected] URL does not work because the browser thinks your realm is "username:[email protected]" i nstead of "www.company.com".<P>
You can use a Java servlet to pass a 401 exception to the browser to l og someone off of TestRealm (in most cases, this is "www.company.com") :<P>
// From Terry Courtney
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class LogOff extends HttpServlet {
public void init(ServletConfig config)
throws ServletException
{
super.init(config) ;
}
public void doGet (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
String auth ;
// get output streem
ServletOutputStream out = res.getOutputStream() ;
// get authorization from header
auth = req.getHeader("Authorization") ;
// if (auth == null) { //It's a logic Error,rem by dingxiang
if (auth != null) {
// force prompt of login
res.setContentType("text/html");
res.setHeader("WWW-Authenticate", "WWW-Authenticate: basic realm =\"/TestRealm\"") ;
res.setStatus(401, "401 Unauthorized") ;
}
out.println("Hi") ;
} // end doGet
} // end class LogOff
When you call this servlet w/ a URL of http://www.company.com/LogOff, it will send the right HTTP headers back to the browser to trick the b rowser into thinking that the user did not authenticate with this Real m.<P>
This servlet can also be written as a LotusScript agent.
=====================
敬请关注NotesFAQ站。
-- :◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
: ◇◇◇◇◇◇◇◇◇◇◇◇◇
: 总是想灌水*#$@&%!~
: ◇◇◇◇◇◇◇◇◇◇◇◇◇
:◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.96.167.50]
|
|