I would like to save my root directory string in a variable so that if the URL of my site ever changes I'll just have to change that variable and all links will work still. I've tried it in a usercontrol but since it's not in the page load no pages that bring that usercontrol in can see the variable.
I would probably put it in the web.config file. Then, everytime you need it, read it from the web.config file. When you need to change it, simply change the web.config and you don't even have to do a republish of your site.
will that always just give me the http:// and domain name? I just didn't know if it would also include any directories so I didn't use it. Ill test for myself and just use that then when I get a chance. Thanks.
AbsolutePath will only return /images/img1.png from the URL.
If you only want the protocal (scheme) and the domain (host), then you need to access it from two separate properties of the Request object. These are Request.Url.Host and Request.Url.Scheme. Then it's just a matter of concatenating the two values together.
However, I would highly recommend that you DO NOT use absolute URL's in your website. For the very reason you originally stated.
Rather than hard-coding the URL, use a Project Path symbol to specify a relative URL to the directory you are in.