我正在尝试进行重定向,我有一个单例类,它是我的配置类,获取有关此的信息并使用我的连接字符串,我将这些数据保存在加密文件中,我正在使用每个请求的会话,然后在安装之前我需要检查会话配置文件,如果没有我抛出异常。
protected void Application_BeginRequest()
{
if (!Settings.Data.Valid())
throw new SingletonException();
var session = SessionManager.SessionFactory.OpenSession();
if (!session.Transaction.IsActive)
session.BeginTransaction(IsolationLevel.ReadCommitted);
CurrentSessionContext.Bind(session);
}
如果有,我必须重定向到作为单例类的设置页面。
protected void Application_Error(Object sender, EventArgs e)
{
Exception exc = Server.GetLastError();
while (exc != null)
{
if (exc.GetType() == typeof(SingletonException))
{
Response.Redirect(@"~/Settings/Index");
}
exc = exc.InnerException;
}
}
但是我遇到了这个重定向的问题,浏览器中的链接正在改变,但我有一个重定向循环,已经尝试清除 cookie 并启用外部站点的选项。
有人能帮我吗?