function CheckUrl(url:string):boolean;
var
    hSession, hfile, hRequest: hInternet;
    dwindex,dwcodelen :dword;
    dwcode:array[1..20] of char;
    res : pchar;
begin
    //检查URL是否包含http://,如果不包含则加上    
    if pos('http://',lowercase(url))=0 then     
        url := 'http://'+url;     
   
    Result := false;     
   
    hSession := InternetOpen('InetURL:/1.0',     
        INTERNET_OPEN_TYPE_PRECONFIG,nil, nil, 0); //建立会话句柄    
    if assigned(hsession) then     
    begin     
        hfile := InternetOpenUrl(hsession, pchar(url), nil, 0,    
            INTERNET_FLAG_RELOAD, 0);        //打开URL所指资源    
   
        dwIndex := 0;     
        dwCodeLen := 10;     
        HttpQueryInfo(hfile, HTTP_QUERY_STATUS_CODE,     
            @dwcode, dwcodeLen, dwIndex); //获取返回的HTTP头信息    
   
        res := pchar(@dwcode);
        ShowMessAge(pchar(@dwcode));
        result:= (res ='200');
   
        if assigned(hfile) then     
            InternetCloseHandle(hfile);     //关闭URL资源句柄    
        InternetCloseHandle(hsession);     //关闭Internet会话句柄    
    end;
end;var
  IMGHttp:TIDHttp;
begin
  IMGHttp:=TIDHttp.Create(nil);
  Try
    IMGHttp.Disconnect;
    IMGHttp.HandleRedirects:= True;
    IMGHttp.ReadTimeout:= 10*1000;
    IMGHttp.Request.UserAgent:='Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)';
    IMGHttp.Get('http://127.0.0.1/301.asp');
    ShowMessAge(IntToStr(IMGHttp.ResponseCode));
  Finally
    IMGHttp.Free;
  End;
end;使用以上两种方式均无法判断301或者302.而是直接返回了转向后的地址状态200
请问各位大牛有什么方法判断么?