Building successfull urls

This commit is contained in:
Paul Schneider 2017-05-16 02:16:09 +02:00
commit 7bca9b1e50
10 changed files with 51 additions and 37 deletions

View file

@ -1,4 +1,5 @@
using System;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc.Rendering;
using Yavsc.Models.Drawing;
@ -11,5 +12,11 @@ namespace Yavsc.Helpers
if (c==null) return new HtmlString("#000");
return new HtmlString(String.Format("#{0:X2}{1:X2}{2:X2}", c.Red, c.Green, c.Blue));
}
public static string ToAbsolute(this HttpRequest request, string url)
{
var host = request.Host;
var isSecure = request.Headers[Constants.SshHeaderKey]=="on";
return (isSecure ? "https" : "http") + $"://{host}/{url}";
}
}
}
}