# Implement a Warmup service plugin

In this tutorial, you implement a custom Warmup service plugin with *High* priority that enables you to specify a list within a text file with exact URLs of pages you want request during system restart.

1. Create the text file, for example, `WarmupUrls.txt`, with the absolute URLs that are to be requested during warmup.   The URLs need to be separated by a new line, for example:
   * *<http://my-site.com/Home>*
   * *<https://my-site-2.com/About>*
2. In the `SitefinityWebApp` project, create a new folder and name it `Warmup`.
3. Create a class `UrlsPlugin.cs`
4. In the `UrlsPlugin` class, paste the following code:
   ```C#
   using System;
   using System.Collections.Generic;
   using System.Collections.Specialized;
   using System.IO;
   using System.Linq;
   using System.Web.Hosting;
   using Telerik.Sitefinity.Warmup;

   namespace SitefinityWebApp.Warmup
   {
       /// <summary>
       /// Plugin for the <see cref="WarmupModule"/> that returns a <see cref="WarmupUrl"/> collection for absolute URLs from a text file.
       /// </summary>
       public class UrlsPlugin : IWarmupPlugin
       {
           #region Properties

           /// <summary>
           /// Gets the name of the warmup plug-in.
           /// </summary>
           /// <value>
           /// The name of the warmup plug-in.
           /// </value>
           public string Name { get; private set; }

           #endregion

           #region Public Methods

           /// <summary>
           /// Initializes the new instance of the warmup plug-in.
           /// </summary>
           /// <param name="name">The name of the plug-in instance.</param>
           /// <param name="parameters">Collection of parameters to initialize the instance with.</param>
           public void Initialize(string name, NameValueCollection parameters)
           {
               this.Name = name;

               var urlsFilePath = parameters[UrlsPlugin.PageUrlsFilePathKey];
               if (!urlsFilePath.IsNullOrEmpty())
               {
                   var absolutePath = HostingEnvironment.MapPath(urlsFilePath);
                   if (!File.Exists(absolutePath))
                       throw new FileNotFoundException("The specified file from the Warmup configuration was not found.", absolutePath);

                   this.pageUrls = File.ReadAllLines(absolutePath).Where(l => !l.IsNullOrEmpty() && Uri.IsWellFormedUriString(l, UriKind.Absolute));
               }
           }

           /// <summary>
           /// Gets the URLs.
           /// </summary>
           /// <returns>
           /// The URLs collection.
           /// </returns>
           public IEnumerable<WarmupUrl> GetUrls()
           {
               return this.pageUrls.Select(u => new WarmupUrl(u) { Priority = WarmupPriority.High });
           }

           #endregion

           #region Fields and Constants

           private IEnumerable<string> pageUrls = Enumerable.Empty<string>();

           private const string PageUrlsFilePathKey = "urlsFilePath";

           #endregion
       }
   }
   ```

Next, you add the plugin configuration in the backend or on the file system. Refer to the following sections.

## Add the plugin configuration in the backend

1. Navigate to *Administration* » *Settings* » *Advanced settings* » *Warmup*.
2. Expand the *Warmup* node and then the *Plugins* node.
3. Click *Create new* and enter values the following fields:
   * *Name*: `URLs Plugin`
   * *Type*: `SitefinityWebApp.Warmup.UrlsPlugin`
   * Make sure the *Enabled* checkbox is selected.
   * Set the priority to *High.*
4. Save your changes.

As a result, you can see your newly created plugin in the *Plugins* node.

To add a plugin parameter:

1. Navigate to *Plugins* » *URLs Plugin* » *Parameters*.
2. Click *Create new*.
3. Enter the following:
   * *Key*: `urlsFilePath`
   * *Value*: `~/App_Data/WarmupUrls.txt`
4. Save your changes.

After full restart of your site, the Warmup service can leverage the URLs Plugin.

## Add the plugin configuration on the file system

In the `~/App_Data/Sitefinity/Configuration` folder of your application create a `WarmupConfig.config` file and paste the following code:

```XML
<?xml version="1.0" encoding="utf-8"?>

<warmupConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type" config:version="10.0.6400.0">
 <plugins>
   <add enabled="True" priority="High" type="SitefinityWebApp.Warmup.UrlsPlugin" urlsFilePath="~/App_Data/WarmupUrls.txt" name="URLs Plugin"/>
 </plugins>
</warmupConfig>
```

> info **NOTE**: The `urlsFilePath` parameter specifies the application’s relative path to the text file that contains the list with absolute URLs to be requested during warmup.
