2009-08-14 10 views
8

Używam formantu WebBrowser w .Net do przeprowadzania konwersji marketingowych podmiotów stowarzyszonych innych firm.Buforowanie i formant WebBrowser w .Net

Mam tabelę kolejki w bazie danych ze wszystkimi skryptami/obrazami do wykonania. Przeglądam je wszystkie w aplikacji WinForms z formantem WebBrowser. Po wykonaniu skryptu/obrazu Usuwam kontrolkę WebBrowser, ustawię na wartość null i odnawiam ją za pomocą nowej instancji kontroli WebBrowser.

Rozważmy następujący adres URL: http://renderserver/RenderScript.aspx?id=1

RenderScript.aspx wyświetla obraz z adresu URL np http://3rdparty/img.ashx?id=9343

używam Skrzypek, aby zobaczyć wszystkie żądania i odpowiedzi, a gdy ten sam adres URL jest wykonywany dwukrotnie, to używa jakiejś pamięci podręcznej. Pamięć podręczna istnieje pod samą kontrolką WebBrowser.

Ta pamięć podręczna oznacza, że ​​plik img.ashx nie jest wywoływany.

Próbowałem użyć przeglądarki Internet Explorer, aby poprosić o URL: http://renderserver/RenderScript.aspx?id=1 i nacisnąć F5. Wtedy jest to wymagane idealnie.

Ale jeśli kliknę pasek adresu i wciśnie Enter, nastąpi powrót do tego samego adresu URL - nie jest on wymagany. Kiedy używam Firefoksa, zawsze będę żądał strony i obrazu bez względu na to, czy użyję F5, czy nawigację z paska adresu.

Znalazłem kilka wywołań Win32 API (http://support.microsoft.com/kb/326201), które mogły wyczyścić pamięć podręczną. Działało na mojej lokalnej maszynie. Następnie aplikacja została wdrożona na serwerze z systemem Windows Server 2003 Standard x64 (moją własną maszyną jest Vista x86).

A teraz wywołania API, aby wyczyścić pamięć podręczną, nie działa.

Wszelkie pomysły na to, dlaczego wywołania interfejsu API nie działają w systemie Windows Server, ale działają w systemie Vista? Obie maszyny z IE8.

Odpowiedz

4

miałem s ame problem (dość) jakiś czas temu. Microsoft ma stronę, który był bardzo pomocny w tym:

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q326/2/01.asp&NoWebContent=1

Stworzyłem klasę poza próbą Microsoftu, jednak miałem również dodać kilka if aby zatrzymać przetwarzanie, gdy nie ma więcej elementów; Minęło już trochę czasu, ale jestem prawie pewien, że spowodowałby to błąd (patrz kod poniżej poniżej: ERROR_NO_MORE_ITEMS).

Mam nadzieję, że będzie pomocna!

using System; 
using System.Runtime.InteropServices; 

// copied from: http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q326/2/01.asp&NoWebContent=1 

namespace PowerCode 
{ 
    public class IECache 
    { 
     // For PInvoke: Contains information about an entry in the Internet cache 
     [StructLayout(LayoutKind.Explicit, Size = 80)] 
     public struct INTERNET_CACHE_ENTRY_INFOA 
     { 
      [FieldOffset(0)] 
      public uint dwStructSize; 
      [FieldOffset(4)] 
      public IntPtr lpszSourceUrlName; 
      [FieldOffset(8)] 
      public IntPtr lpszLocalFileName; 
      [FieldOffset(12)] 
      public uint CacheEntryType; 
      [FieldOffset(16)] 
      public uint dwUseCount; 
      [FieldOffset(20)] 
      public uint dwHitRate; 
      [FieldOffset(24)] 
      public uint dwSizeLow; 
      [FieldOffset(28)] 
      public uint dwSizeHigh; 
      [FieldOffset(32)] 
      public FILETIME LastModifiedTime; 
      [FieldOffset(40)] 
      public FILETIME ExpireTime; 
      [FieldOffset(48)] 
      public FILETIME LastAccessTime; 
      [FieldOffset(56)] 
      public FILETIME LastSyncTime; 
      [FieldOffset(64)] 
      public IntPtr lpHeaderInfo; 
      [FieldOffset(68)] 
      public uint dwHeaderInfoSize; 
      [FieldOffset(72)] 
      public IntPtr lpszFileExtension; 
      [FieldOffset(76)] 
      public uint dwReserved; 
      [FieldOffset(76)] 
      public uint dwExemptDelta; 
     } 

     // For PInvoke: Initiates the enumeration of the cache groups in the Internet cache 
     [DllImport(@"wininet", SetLastError = true, CharSet = CharSet.Auto, EntryPoint = "FindFirstUrlCacheGroup", CallingConvention = CallingConvention.StdCall)] 
     public static extern IntPtr FindFirstUrlCacheGroup(int dwFlags, int dwFilter, IntPtr lpSearchCondition, int dwSearchCondition, ref long lpGroupId, IntPtr lpReserved); 

     // For PInvoke: Retrieves the next cache group in a cache group enumeration 
     [DllImport(@"wininet", SetLastError = true, CharSet = CharSet.Auto, EntryPoint = "FindNextUrlCacheGroup", CallingConvention = CallingConvention.StdCall)] 
     public static extern bool FindNextUrlCacheGroup(IntPtr hFind, ref long lpGroupId, IntPtr lpReserved); 

     // For PInvoke: Releases the specified GROUPID and any associated state in the cache index file 
     [DllImport(@"wininet", SetLastError = true, CharSet = CharSet.Auto, EntryPoint = "DeleteUrlCacheGroup", CallingConvention = CallingConvention.StdCall)] 
     public static extern bool DeleteUrlCacheGroup(long GroupId, int dwFlags, IntPtr lpReserved); 

     // For PInvoke: Begins the enumeration of the Internet cache 
     [DllImport(@"wininet", SetLastError = true, CharSet = CharSet.Auto, EntryPoint = "FindFirstUrlCacheEntryA", CallingConvention = CallingConvention.StdCall)] 
     public static extern IntPtr FindFirstUrlCacheEntry([MarshalAs(UnmanagedType.LPTStr)] string lpszUrlSearchPattern, IntPtr lpFirstCacheEntryInfo, ref int lpdwFirstCacheEntryInfoBufferSize); 

     // For PInvoke: Retrieves the next entry in the Internet cache 
     [DllImport(@"wininet", SetLastError = true, CharSet = CharSet.Auto, EntryPoint = "FindNextUrlCacheEntryA", CallingConvention = CallingConvention.StdCall)] 
     public static extern bool FindNextUrlCacheEntry(IntPtr hFind, IntPtr lpNextCacheEntryInfo, ref int lpdwNextCacheEntryInfoBufferSize); 

     // For PInvoke: Removes the file that is associated with the source name from the cache, if the file exists 
     [DllImport(@"wininet", SetLastError = true, CharSet = CharSet.Auto, EntryPoint = "DeleteUrlCacheEntryA", CallingConvention = CallingConvention.StdCall)] 
     public static extern bool DeleteUrlCacheEntry(IntPtr lpszUrlName); 

     public static void ClearCache() 
     { 
      // Indicates that all of the cache groups in the user's system should be enumerated 
      const int CACHEGROUP_SEARCH_ALL = 0x0; 
      // Indicates that all the cache entries that are associated with the cache group 
      // should be deleted, unless the entry belongs to another cache group. 
      const int CACHEGROUP_FLAG_FLUSHURL_ONDELETE = 0x2; 
      // File not found. 
      const int ERROR_FILE_NOT_FOUND = 0x2; 
      // No more items have been found. 
      const int ERROR_NO_MORE_ITEMS = 259; 
      // Pointer to a GROUPID variable 
      long groupId = 0; 

      // Local variables 
      int cacheEntryInfoBufferSizeInitial = 0; 
      int cacheEntryInfoBufferSize = 0; 
      IntPtr cacheEntryInfoBuffer = IntPtr.Zero; 
      INTERNET_CACHE_ENTRY_INFOA internetCacheEntry; 
      IntPtr enumHandle = IntPtr.Zero; 
      bool returnValue = false; 

      // Delete the groups first. 
      // Groups may not always exist on the system. 
      // For more information, visit the following Microsoft Web site: 
      // http://msdn.microsoft.com/library/?url=/workshop/networking/wininet/overview/cache.asp    
      // By default, a URL does not belong to any group. Therefore, that cache may become 
      // empty even when the CacheGroup APIs are not used because the existing URL does not belong to any group.    
      enumHandle = FindFirstUrlCacheGroup(0, CACHEGROUP_SEARCH_ALL, IntPtr.Zero, 0, ref groupId, IntPtr.Zero); 

      // If there are no items in the Cache, you are finished. 
      if (enumHandle != IntPtr.Zero && ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error()) { 
       return; 
      } 

      // Loop through Cache Group, and then delete entries. 
      while (true) { 
       if (ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error() || ERROR_FILE_NOT_FOUND == Marshal.GetLastWin32Error()) { 
        break; 
       } 

       // Delete a particular Cache Group. 
       returnValue = DeleteUrlCacheGroup(groupId, CACHEGROUP_FLAG_FLUSHURL_ONDELETE, IntPtr.Zero); 
       if (!returnValue && ERROR_FILE_NOT_FOUND == Marshal.GetLastWin32Error()) { 
        returnValue = FindNextUrlCacheGroup(enumHandle, ref groupId, IntPtr.Zero); 
       } 

       if (!returnValue && (ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error() || ERROR_FILE_NOT_FOUND == Marshal.GetLastWin32Error())) { 
        break; 
       } 
      } 

      // Start to delete URLs that do not belong to any group. 
      enumHandle = FindFirstUrlCacheEntry(null, IntPtr.Zero, ref cacheEntryInfoBufferSizeInitial); 
      if (enumHandle != IntPtr.Zero && ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error()) { 
       return; 
      } 

      cacheEntryInfoBufferSize = cacheEntryInfoBufferSizeInitial; 
      cacheEntryInfoBuffer = Marshal.AllocHGlobal(cacheEntryInfoBufferSize); 
      enumHandle = FindFirstUrlCacheEntry(null, cacheEntryInfoBuffer, ref cacheEntryInfoBufferSizeInitial); 

      while (true) { 
       internetCacheEntry = (INTERNET_CACHE_ENTRY_INFOA)Marshal.PtrToStructure(cacheEntryInfoBuffer, typeof(INTERNET_CACHE_ENTRY_INFOA)); 

       if (ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error()) { 
        break; 
       } 

       cacheEntryInfoBufferSizeInitial = cacheEntryInfoBufferSize; 
       returnValue = DeleteUrlCacheEntry(internetCacheEntry.lpszSourceUrlName); 
       if (!returnValue) { 
        returnValue = FindNextUrlCacheEntry(enumHandle, cacheEntryInfoBuffer, ref cacheEntryInfoBufferSizeInitial); 
       } 
       if (!returnValue && ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error()) { 
        break; 
       } 
       if (!returnValue && cacheEntryInfoBufferSizeInitial > cacheEntryInfoBufferSize) { 
        cacheEntryInfoBufferSize = cacheEntryInfoBufferSizeInitial; 
        cacheEntryInfoBuffer = Marshal.ReAllocHGlobal(cacheEntryInfoBuffer, (IntPtr)cacheEntryInfoBufferSize); 
        returnValue = FindNextUrlCacheEntry(enumHandle, cacheEntryInfoBuffer, ref cacheEntryInfoBufferSizeInitial); 
       } 
      } 
      Marshal.FreeHGlobal(cacheEntryInfoBuffer); 
     } 
    } 
} 

Aby użyć go w kodzie, po prostu zadzwoń:

IECache.ClearCache() 

przed wywołaniem metody nawigacji.

0

Fiddler używa zasadniczo ten sam kod, co w artykule KB, aby wyczyścić pamięć podręczną WinINET i używam go na Win2k3 każdego dnia.

Zamiast wymazywać całą pamięć podręczną użytkownika, właściwą poprawką jest ustawienie odpowiedniego nagłówka odpowiedzi HTTP w celu zablokowania buforowania. Więcej informacji na temat buforowania WinINET można znaleźć tutaj: http://www.enhanceie.com/redir/?id=httpperf

(Można też po prostu dodać losowy parametr ciągu zapytania, w ten sposób za każdym razem, gdy formant napotka żądanie dla zasobu, adres URL jest inny, a pamięć podręczna jest inna w ten sposób automatycznie zablokowane)

+0

Negatywny. Nie ma nic wspólnego z nagłówkami pamięci podręcznej. Są już ustawione poprawnie, aby uniknąć buforowania. Inne przeglądarki nie buforują, jak zauważyłem. – MartinHN

+0

A parametr randomizowany również nie działa. Ponieważ HTML strony trzeciej załadowany przez stronę ScriptRender jest całkowicie poza moją kontrolą. Mogę więc tylko dodać parametr do strony RenderScript. Tag obrazu (czasami IFrame, czasami javascript) jest ładowany statycznym adresem URL. – MartinHN

+0

Przepraszam, ale się mylisz. WinINET/IE/WebOCs nie będą ponownie używać buforowanych odpowiedzi, jeśli ustawione zostaną odpowiednie nagłówki odpowiedzi. Jakie są dokładne nagłówki wysyłane przez ASHX? Czy możesz wysłać mi Network Capture (www.fiddlercap.com)? – EricLaw

-1

to powinno załatwić sprawę.

Response.Cache.SetCacheability(HttpCacheability.NoCache); 
+1

-1: on nie mówi o ASP.NET. Mówi o IE. –

0

spróbować tego ...

[DllImport("wininet.dll", SetLastError = true)] 
     private static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int lpdwBufferLength); 
private const int INTERNET_OPTION_END_BROWSER_SESSION = 42; 
private void clearCache() 
{ 
    try 
    { 
     Utilities.Web.WebBrowserHelper.WebBrowserHelper.ClearCache(); 
     InternetSetOption(IntPtr.Zero, INTERNET_OPTION_END_BROWSER_SESSION, IntPtr.Zero, 0); 
    } 
    catch (Exception exception) 
    { 
     //throw; 
    } 

} 
+1

Gdzie zdefiniowano 'Utilities.Web.WebBrowserHelper.WebBrowserHelper.ClearCache();' '? – Nate

0

Każdy artykuł, do którego prowadzą linki, zawiera liczne błędy (skąd pochodzi kod źródłowy wybranej odpowiedzi), a ja zmarnowałem ~ 2 dni, próbując uruchomić go we wszystkich niezbędnych ustawieniach. Jest to kopia wklejona w Internecie, a zgłoszono wiele błędów na podstawie wersji systemu operacyjnego i IE.

Fiddler został napisany przez pracownika firmy Microsoft i jest obsługiwany przez FiddlerCore.dll. Telerik (obecni właściciele/opiekunowie/sprzedawcy) Fiddlera wciąż aktualizuje, utrzymuje i rozdaje FiddlerCore za darmo. Jeśli nie chcesz dodawać odniesienia do FiddlerCore, możesz dezasemblować bibliotekę dll i pokazuje ona PRAWIDŁOWY sposób wywoływania wszystkich tych potwornie udokumentowanych funkcji WinINet, ale myślę, że umieszczenie go tutaj byłoby nieużytkiem dla Telerik/plagarism.

Obecnie Fiddlercore jest gospodarzem tutaj: http://www.telerik.com/fiddler/fiddlercore

0

Oryginalny kod z https://support.microsoft.com/en-us/kb/326201 wydaje buggy

sprawdzenie dokumentacji MSDN, a także wersję VB tutaj: https://support.microsoft.com/en-us/kb/262110

I zmodyfikowany kod jak to i teraz działa dla mnie (problem polegał na wykonaniu FindNextUrlCacheGroup i FindNextUrlCacheEntry):

using System; 
using System.Runtime.InteropServices; 

namespace Q326201CS 
{ 
    // Class for deleting the cache. 
    public class DeleteIECache 
    { 
     // For PInvoke: Contains information about an entry in the Internet cache 
     [StructLayout(LayoutKind.Explicit, Size=80)] 
     public struct INTERNET_CACHE_ENTRY_INFOA 
     { 
      [FieldOffset(0)] public uint dwStructSize; 
      [FieldOffset(4)] public IntPtr lpszSourceUrlName; 
      [FieldOffset(8)] public IntPtr lpszLocalFileName; 
      [FieldOffset(12)] public uint CacheEntryType; 
      [FieldOffset(16)] public uint dwUseCount; 
      [FieldOffset(20)] public uint dwHitRate; 
      [FieldOffset(24)] public uint dwSizeLow; 
      [FieldOffset(28)] public uint dwSizeHigh; 
      [FieldOffset(32)] public FILETIME LastModifiedTime; 
      [FieldOffset(40)] public FILETIME ExpireTime; 
      [FieldOffset(48)] public FILETIME LastAccessTime; 
      [FieldOffset(56)] public FILETIME LastSyncTime; 
      [FieldOffset(64)] public IntPtr lpHeaderInfo; 
      [FieldOffset(68)] public uint dwHeaderInfoSize; 
      [FieldOffset(72)] public IntPtr lpszFileExtension; 
      [FieldOffset(76)] public uint dwReserved; 
      [FieldOffset(76)] public uint dwExemptDelta; 
     } 

     // For PInvoke: Initiates the enumeration of the cache groups in the Internet cache 
     [DllImport(@"wininet", 
      SetLastError=true, 
      CharSet=CharSet.Auto, 
      EntryPoint="FindFirstUrlCacheGroup", 
      CallingConvention=CallingConvention.StdCall)] 
     public static extern IntPtr FindFirstUrlCacheGroup(
      int dwFlags, 
      int dwFilter, 
      IntPtr lpSearchCondition, 
      int dwSearchCondition, 
      ref long lpGroupId, 
      IntPtr lpReserved); 

     // For PInvoke: Retrieves the next cache group in a cache group enumeration 
     [DllImport(@"wininet", 
      SetLastError=true, 
      CharSet=CharSet.Auto, 
      EntryPoint="FindNextUrlCacheGroup", 
      CallingConvention=CallingConvention.StdCall)] 
     public static extern bool FindNextUrlCacheGroup(
      IntPtr hFind, 
      ref long lpGroupId, 
      IntPtr lpReserved); 

     // For PInvoke: Releases the specified GROUPID and any associated state in the cache index file 
     [DllImport(@"wininet", 
      SetLastError=true, 
      CharSet=CharSet.Auto, 
      EntryPoint="DeleteUrlCacheGroup", 
      CallingConvention=CallingConvention.StdCall)] 
     public static extern bool DeleteUrlCacheGroup(
      long GroupId, 
      int dwFlags, 
      IntPtr lpReserved); 

     // For PInvoke: Begins the enumeration of the Internet cache 
     [DllImport(@"wininet", 
      SetLastError=true, 
      CharSet=CharSet.Auto, 
      EntryPoint="FindFirstUrlCacheEntryA", 
      CallingConvention=CallingConvention.StdCall)] 
     public static extern IntPtr FindFirstUrlCacheEntry(
      [MarshalAs(UnmanagedType.LPTStr)] string lpszUrlSearchPattern, 
      IntPtr lpFirstCacheEntryInfo, 
      ref int lpdwFirstCacheEntryInfoBufferSize); 

     // For PInvoke: Retrieves the next entry in the Internet cache 
     [DllImport(@"wininet", 
      SetLastError=true, 
      CharSet=CharSet.Auto, 
      EntryPoint="FindNextUrlCacheEntryA", 
      CallingConvention=CallingConvention.StdCall)] 
     public static extern bool FindNextUrlCacheEntry(
      IntPtr hFind, 
      IntPtr lpNextCacheEntryInfo, 
      ref int lpdwNextCacheEntryInfoBufferSize); 

     // For PInvoke: Removes the file that is associated with the source name from the cache, if the file exists 
     [DllImport(@"wininet", 
      SetLastError=true, 
      CharSet=CharSet.Auto, 
      EntryPoint="DeleteUrlCacheEntryA", 
      CallingConvention=CallingConvention.StdCall)] 
     public static extern bool DeleteUrlCacheEntry(
      IntPtr lpszUrlName); 


     public static void doDelete() 
     { 
      // Indicates that all of the cache groups in the user's system should be enumerated 
      const int CACHEGROUP_SEARCH_ALL = 0x0; 
      // Indicates that all the cache entries that are associated with the cache group 
      // should be deleted, unless the entry belongs to another cache group. 
      const int CACHEGROUP_FLAG_FLUSHURL_ONDELETE = 0x2; 
      // File not found. 
      const int ERROR_FILE_NOT_FOUND = 0x2; 
      // No more items have been found. 
      const int ERROR_NO_MORE_ITEMS = 259; 
      // Pointer to a GROUPID variable 
      long groupId = 0; 

      // Local variables 
      int cacheEntryInfoBufferSizeInitial = 0; 
      int cacheEntryInfoBufferSize = 0; 
      IntPtr cacheEntryInfoBuffer = IntPtr.Zero; 
      INTERNET_CACHE_ENTRY_INFOA internetCacheEntry; 
      IntPtr enumHandle = IntPtr.Zero; 
      bool returnValue = false; 

      // Delete the groups first. 
      // Groups may not always exist on the system. 
      // For more information, visit the following Microsoft Web site: 
      // http://msdn.microsoft.com/library/?url=/workshop/networking/wininet/overview/cache.asp   
      // By default, a URL does not belong to any group. Therefore, that cache may become 
      // empty even when the CacheGroup APIs are not used because the existing URL does not belong to any group.   
      enumHandle = FindFirstUrlCacheGroup(0, CACHEGROUP_SEARCH_ALL, IntPtr.Zero, 0, ref groupId, IntPtr.Zero); 
      // If there are no items in the Cache, you are finished. 
      if (enumHandle != IntPtr.Zero && ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error()) 
       return; 

      // Loop through Cache Group, and then delete entries. 
      while(true) 
      { 
       if (ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error() || ERROR_FILE_NOT_FOUND == Marshal.GetLastWin32Error()) 
       { 
        break; 
       } 

       // Delete a particular Cache Group. 
       returnValue = DeleteUrlCacheGroup(groupId, CACHEGROUP_FLAG_FLUSHURL_ONDELETE, IntPtr.Zero); 
       //if (returnValue || (!returnValue && ERROR_FILE_NOT_FOUND == Marshal.GetLastWin32Error())) 
       //{ 
        returnValue = FindNextUrlCacheGroup(enumHandle, ref groupId, IntPtr.Zero); 
       //} 

       if (!returnValue && (ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error() || ERROR_FILE_NOT_FOUND == Marshal.GetLastWin32Error())) 
        break; 
      } 

      // Start to delete URLs that do not belong to any group. 
      enumHandle = FindFirstUrlCacheEntry(null, IntPtr.Zero, ref cacheEntryInfoBufferSizeInitial); 
      if (enumHandle == IntPtr.Zero && ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error()) 
       return; 

      cacheEntryInfoBufferSize = cacheEntryInfoBufferSizeInitial; 
      cacheEntryInfoBuffer = Marshal.AllocHGlobal(cacheEntryInfoBufferSize); 
      enumHandle = FindFirstUrlCacheEntry(null, cacheEntryInfoBuffer, ref cacheEntryInfoBufferSizeInitial); 

      while(true) 
      { 
       internetCacheEntry = (INTERNET_CACHE_ENTRY_INFOA)Marshal.PtrToStructure(cacheEntryInfoBuffer, typeof(INTERNET_CACHE_ENTRY_INFOA)); 

       if (ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error()) 
       { 
        break; 
       } 

       cacheEntryInfoBufferSizeInitial = cacheEntryInfoBufferSize; 
       returnValue = DeleteUrlCacheEntry(internetCacheEntry.lpszSourceUrlName);     
       //if (!returnValue) 
       //{ 
        returnValue = FindNextUrlCacheEntry(enumHandle, cacheEntryInfoBuffer, ref cacheEntryInfoBufferSizeInitial); 
       //} 
       if (!returnValue && ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error()) 
       { 
        break; 
       }   
       if (!returnValue && cacheEntryInfoBufferSizeInitial > cacheEntryInfoBufferSize) 
       { 
        cacheEntryInfoBufferSize = cacheEntryInfoBufferSizeInitial; 
        cacheEntryInfoBuffer = Marshal.ReAllocHGlobal(cacheEntryInfoBuffer, (IntPtr) cacheEntryInfoBufferSize); 
        returnValue = FindNextUrlCacheEntry(enumHandle, cacheEntryInfoBuffer, ref cacheEntryInfoBufferSizeInitial);     
       } 
      } 
      Marshal.FreeHGlobal(cacheEntryInfoBuffer);  
     } 
    } 
} 
Powiązane problemy