登录后默认转向登陆前的页面排除外部网站页面

 
///   <summary>
        
///  从cookie中获取转向页
        
///   </summary>
        
///   <returns></returns>
         public   static   string  GetReUrl()
        {
            
string  LoginURl  =  PubRequest.GetCurrentFullHost()  +  System.Web.HttpContext.Current.Request.ApplicationPath  +   " Account/login.aspx " ;
            
string  GetUrlReferrerStr  =  PubRequest.GetUrlReferrer().ToLower();
            
string  GetCurrentHostStr  =  PubRequest.GetCurrentFullHost()  +  System.Web.HttpContext.Current.Request.ApplicationPath;
            
if  (PubRequest.GetString( " reurl " ).Trim()  !=   "" )
            {
                Utils.WriteCookie(
" reurl " , PubRequest.GetString( " reurl " ).Trim());
                
return  PubRequest.GetString( " reurl " ).Trim();
            }
            
else   if  (GetUrlReferrerStr.IndexOf(GetCurrentHostStr.ToLower())  >   - 1   &&  GetUrlReferrerStr.IndexOf(LoginURl.ToLower())  <   0 )
            {
                Utils.WriteCookie(
" reurl " , PubRequest.GetUrlReferrer());
                
return  PubRequest.GetUrlReferrer();
            }
            
else
            {
                
if  (Utils.GetCookie( " reurl " ==   "" )
                {
                    
return   " ../index.aspx " ;
                }
                
else
                {
                    
return  Utils.GetCookie( " reurl " );
                }
            }
        }

你可能感兴趣的:(String)