Kontakt

Super at du er her! Vi vil også gerne i kontakt med dig. Lad os høre dit ærinde, så vender vi tilbage hurtigst muligt. 

Skabertrang
Stagehøjvej 27a
8600 Silkeborg
T: 86 82 16 55
M: info@skabertrang.dk
Exception in template (Designs\skabertrang\Paragraph\SB_Paragraph-APITEST.cshtml): System.Net.WebException: The remote server returned an error: (401) Unauthorized.
   at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
   at System.Net.WebClient.DownloadString(Uri address)
   at CompiledRazorTemplates.Dynamic.eedcebadfabdd.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
   at Dynamicweb.Rendering.Template.Output()
@using System.IO @using System.Web @helper RenderGoogleConversion(string conversionId, string conversionLanguage, string conversionFormat, string conversionColor, string conversionLabel, string conversionValue, string conversionCurrency, bool remarketingOnly) { var googleConversionId = conversionId; var googleConversionLanguage = string.IsNullOrWhiteSpace(conversionLanguage) ? "en" : conversionLanguage; var googleConversionFormat = string.IsNullOrWhiteSpace(conversionFormat) ? "3" : conversionFormat; var googleConversionColor = string.IsNullOrWhiteSpace(conversionColor) ? "ffffff" : conversionColor; var googleConversionLabel = conversionLabel; var googleConversionValue = string.IsNullOrWhiteSpace(conversionValue) ? "0" : conversionValue; var googleConversionCurrency = string.IsNullOrWhiteSpace(conversionCurrency) ? "DKK" : conversionCurrency; var googleRemarketingOnly = remarketingOnly; <!-- Google Code for the Conversion Page --> <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = @(googleConversionId); var google_conversion_language = '@(googleConversionLanguage)'; var google_conversion_format = '@(googleConversionFormat)'; var google_conversion_color = '@(googleConversionColor)'; var google_conversion_label = '@(googleConversionLabel)'; var google_conversion_value = @(googleConversionValue); var google_conversion_currency = '@(googleConversionCurrency)'; var google_remarketing_only = @(googleRemarketingOnly ? "true" : "false"); /* ]]> */ </script> <script type="text/javascript" src="https://www.googleadservices.com/pagead/conversion.js"></script> <noscript> <div style="display: inline;"> <img src="https://www.googleadservices.com/pagead/conversion/@(googleConversionId)/?value=@(googleConversionValue)&amp;currency_code=@(googleConversionCurrency)&amp;label=@(googleConversionLabel)&amp;guid=ON&amp;script=0" alt="" width="1" height="1" style="border-style: none;" /> </div> </noscript> } @helper RenderGoogleAnalyticsEcommerceTracking(string transactionId, string affiliation, string revenue, string shipping, string tax, string currency, string[][] orderLines) { <script type="text/javascript"> if (!window.skabertrang_ga_ecommerce_callbacks) window.skabertrang_ga_ecommerce_callbacks = []; (function() { var orderLines = @(Newtonsoft.Json.JsonConvert.SerializeObject(orderLines)); window.skabertrang_ga_ecommerce_callbacks.push(function() { ga('require', 'ecommerce'); ga('ecommerce:addTransaction', { 'id' : '@(transactionId)', 'affiliation' : '@(affiliation)', 'revenue' : '@(revenue)', 'shipping' : '@(shipping)', 'tax' : '@(tax)', 'currency' : '@(currency)' }); if (orderLines && orderLines.length) { for (var i = 0; i < orderLines.length; i++) { ga('ecommerce:addItem', { 'id' : '@(transactionId)', 'name' : orderLines[i][1], 'sku' : orderLines[i][0], 'category' : orderLines[i][2], 'price' : orderLines[i][3], 'quantity' : orderLines[i][4], 'currency' : '@(currency)' }); } } ga('ecommerce:send'); }); })(); </script> } @functions { string mediaOverlay(string filePath, string filePathThumb = "", string caption = "", string group = "", string alt = "", string title = "", string extraAttributes = "") { var pv = Dynamicweb.Frontend.PageView.Current(); var imageOverlayType = pv.Area.Item["ImageOverlayType"] as string; filePathThumb = !string.IsNullOrWhiteSpace(filePathThumb) ? filePathThumb : filePath; group = !string.IsNullOrWhiteSpace(group) ? group : !string.IsNullOrWhiteSpace(GetString("ParagraphID")) ? GetString("ParagraphID") : "imageGroup"; if (imageOverlayType=="Fancybox") { return "<a class='fancybox media-overlay' href='" + filePath + "' rel='" + group + "' title='" + title + "' data-title='" + caption + "'><img src='"+filePathThumb+"' alt='" + alt + "' title='" + title + "'/></a>"; } else { return "<a href='" + filePath + "' class='media-overlay' data-lightbox='" + group + "' data-title='" + caption + "'><img src='"+filePathThumb+"' alt='" + alt + "' title='" + title + "'/></a>"; } } string GetImage(string image, int width, int height, int compression, int crop, string colorSpace, bool doNotUpscale) { // Crop // 0 = Center // 1 = From upper left // 2 = From lower left // 3 = From lower right // 4 = From upper right // 5 = Keep aspect ratio // 6 = Fit image // ColorSpace // rgb // cmyk // grayscale var param = new List<string>(); param.Add("Image=" + image); param.Add("Format=" + Path.GetExtension(image).Substring(1)); if (width > 0) { param.Add("Width=" + width); } if (height > 0) { param.Add("Height=" + height); } param.Add("Compression=" + compression); param.Add("Crop=" + crop); param.Add("ColorSpace=" + colorSpace); param.Add("DoNotUpscale=" + (doNotUpscale ? "True" : "False")); return "/Admin/Public/GetImage.ashx?" + string.Join("&amp;", param); } string GetImagePlaceholder(int width, int height) { return GetImagePlaceholder(width, height, null, null, null); } string GetImagePlaceholder(int width, int height, string backgroundColor, string textColor, string text) { var r = "https://placehold.it/" + width; if (height > 0) { r += "x" + height; } if (!string.IsNullOrWhiteSpace(backgroundColor) && !string.IsNullOrWhiteSpace(textColor)) { r += "/" + backgroundColor; r += "/" + textColor; } if (!string.IsNullOrWhiteSpace(text)) { r += "?text=" + text.Replace(" ", "+"); } return r; } T LoadContextItem<T>(string key) { var obj = HttpContext.Current.Items != null ? HttpContext.Current.Items[key] : null; if (obj == null) { return default(T); } return (T)obj; } void SaveContextItem(string key, object value) { if (HttpContext.Current.Items != null && value != null) { HttpContext.Current.Items[key] = value; } } string PathCombine(params string[] paths) { return Path.Combine(paths); } string NullIfEmpty(string value) { return string.IsNullOrEmpty(value) ? null : value; } string NullIfWhiteSpace(string value) { return string.IsNullOrWhiteSpace(value) ? null : value; } string ToJson(object value) { return ToJson(value, false); } string ToJson(object value, bool indented) { return Newtonsoft.Json.JsonConvert.SerializeObject( value, indented ? Newtonsoft.Json.Formatting.Indented : Newtonsoft.Json.Formatting.None, new Newtonsoft.Json.Converters.IsoDateTimeConverter { DateTimeFormat = "yyyyMMdd'T'HHmmss" } ); } void AddCssFile(params string[] files) { var list = LoadContextItem<List<string>>("SB.CssFiles"); if (list == null) { list = new List<string>(); } foreach (var file in files) { if (!list.Contains(file, StringComparer.OrdinalIgnoreCase)) { list.Add(file); } } SaveContextItem("SB.CssFiles", list); } void AddJsFile(params string[] files) { var list = LoadContextItem<List<string>>("SB.JsFiles"); if (list == null) { list = new List<string>(); } foreach (var file in files) { if (!list.Contains(file, StringComparer.OrdinalIgnoreCase)) { list.Add(file); } } SaveContextItem("SB.JsFiles", list); } } @using System.Collections.Specialized @using System.IO @using System.Net @using System.Text @using System.Web @{ var paragraphId = GetInteger("ParagraphID"); var isFirst = GetBoolean("ParagraphContainerIsFirst"); var module = GetString("ParagraphModule"); var headline = GetString("Item.Headline"); var headlineFormat = GetString("Item.HeadlineFormat"); var image = GetString("Item.Image"); var text = GetString("Item.Text"); var cssClassName = GetString("Item.CssClassName"); var unwrap = GetBoolean("Item.Unwrap"); if (!string.IsNullOrWhiteSpace(image)) { image = GetImage(image, 2000, 0, 100, 5, "rgb", false); } // Bootstrap var clearfix = GetBoolean("Item.Clearfix"); var phones = GetString("Item.Phones"); var tablets = GetString("Item.Tablets"); var mediumDesktops = GetString("Item.MediumDesktops"); var largeDesktops = GetString("Item.LargeDesktops"); var offsetPhones = GetString("Item.OffsetPhones"); var offsetTablets = GetString("Item.OffsetTablets"); var offsetMediumDesktops = GetString("Item.OffsetMediumDesktops"); var offsetLargeDesktops = GetString("Item.OffsetLargeDesktops"); var pushPhones = GetString("Item.PushPhones"); var pushTablets = GetString("Item.PushTablets"); var pushMediumDesktops = GetString("Item.PushMediumDesktops"); var pushLargeDesktops = GetString("Item.PushLargeDesktops"); var pullPhones = GetString("Item.PullPhones"); var pullTablets = GetString("Item.PullTablets"); var pullMediumDesktops = GetString("Item.PullMediumDesktops"); var pullLargeDesktops = GetString("Item.PullLargeDesktops"); phones = !string.IsNullOrWhiteSpace(phones) ? "col-xs-" + phones : string.Empty; tablets = !string.IsNullOrWhiteSpace(tablets) ? "col-sm-" + tablets : string.Empty; mediumDesktops = !string.IsNullOrWhiteSpace(mediumDesktops) ? "col-md-" + mediumDesktops : string.Empty; largeDesktops = !string.IsNullOrWhiteSpace(largeDesktops) ? "col-lg-" + largeDesktops : string.Empty; offsetPhones = !string.IsNullOrWhiteSpace(offsetPhones) ? "col-xs-offset-" + offsetPhones : string.Empty; offsetTablets = !string.IsNullOrWhiteSpace(offsetTablets) ? "col-sm-offset-" + offsetTablets : string.Empty; offsetMediumDesktops = !string.IsNullOrWhiteSpace(offsetMediumDesktops) ? "col-md-offset-" + offsetMediumDesktops : string.Empty; offsetLargeDesktops = !string.IsNullOrWhiteSpace(offsetLargeDesktops) ? "col-lg-offset-" + offsetLargeDesktops : string.Empty; pushPhones = !string.IsNullOrWhiteSpace(pushPhones) ? "col-xs-push-" + pushPhones : string.Empty; pushTablets = !string.IsNullOrWhiteSpace(pushTablets) ? "col-sm-push-" + pushTablets : string.Empty; pushMediumDesktops = !string.IsNullOrWhiteSpace(pushMediumDesktops) ? "col-md-push-" + pushMediumDesktops : string.Empty; pushLargeDesktops = !string.IsNullOrWhiteSpace(pushLargeDesktops) ? "col-lg-push-" + pushLargeDesktops : string.Empty; pullPhones = !string.IsNullOrWhiteSpace(pullPhones) ? "col-xs-pull-" + pullPhones : string.Empty; pullTablets = !string.IsNullOrWhiteSpace(pullTablets) ? "col-sm-pull-" + pullTablets : string.Empty; pullMediumDesktops = !string.IsNullOrWhiteSpace(pullMediumDesktops) ? "col-md-pull-" + pullMediumDesktops : string.Empty; pullLargeDesktops = !string.IsNullOrWhiteSpace(pullLargeDesktops) ? "col-lg-pull-" + pullLargeDesktops : string.Empty; // init var clsCol = string.Join(" ", (new[] { phones, tablets, mediumDesktops, largeDesktops, offsetPhones, offsetTablets, offsetMediumDesktops, offsetLargeDesktops, pushPhones, pushTablets, pushMediumDesktops, pushLargeDesktops, pullPhones, pullTablets, pullMediumDesktops, pullLargeDesktops }).Where(o => !string.IsNullOrWhiteSpace(o)).ToList()); // https://www.skabertrang.dk/Default.aspx?Id=141967 var designBaseUrl = GetString("Template:DesignBaseUrl"); var json = default(string); var jsonUpdates = default(string); if (File.Exists(HttpContext.Current.Server.MapPath(designBaseUrl + "LinkedInToken.txt"))) { json = File.ReadAllText(HttpContext.Current.Server.MapPath(designBaseUrl + "LinkedInToken.txt")); } if (!string.IsNullOrWhiteSpace(json)) { var jObj = Newtonsoft.Json.Linq.JObject.Parse(json); using (var wc = new WebClient()) { wc.Encoding = Encoding.UTF8; wc.Headers[HttpRequestHeader.Authorization] = "Bearer " + (string)jObj["access_token"]; jsonUpdates = wc.DownloadString("https://api.linkedin.com/v1/companies/3086846/updates?format=json"); } } else { var l_url = "https://www.linkedin.com/oauth/v2/authorization?response_type=code" + "&client_id=78mcefxglp1cwc" + "&state=skabertrang-linkedin-api" + "&redirect_uri=https://www.skabertrang.dk/Default.aspx?Id=141968"; // HttpContext.Current.Response.Redirect(l_url, true); } } @if (clearfix) { <div class="clearfix"></div> } @if (!(string.IsNullOrWhiteSpace(cssClassName) && string.IsNullOrWhiteSpace(headline) && string.IsNullOrWhiteSpace(image) && string.IsNullOrWhiteSpace(text) && string.IsNullOrWhiteSpace(module))) { if (!unwrap) { @: <div class="@(clsCol)"> } <div class="paragraph-block @(cssClassName)"> @if (!string.IsNullOrWhiteSpace(headline)) { if (!string.IsNullOrWhiteSpace(headlineFormat)) { @: <@(headlineFormat)>@(headline)</@(headlineFormat)> } else { if (isFirst) { <h1>@(headline)</h1> } else { <h2>@(headline)</h2> } } } @if (!string.IsNullOrWhiteSpace(image)) { <div class="paragraph-image"> <img src="@(image)" alt="" class="img-responsive"> </div> } @if (!string.IsNullOrWhiteSpace(text)) { <div class="paragraph-text"> @(text) </div> } @if (!string.IsNullOrWhiteSpace(module)) { <div class="paragraph-module"> @(module) </div> } <div class="linkedin-updates"> @if (!string.IsNullOrWhiteSpace(jsonUpdates)) { var updates = Newtonsoft.Json.Linq.JObject.Parse(jsonUpdates); foreach (var item in updates["values"]) { var i_headline = (string)item["updateContent"]["companyStatusUpdate"]["share"]["comment"]; var i_url = (string)item["updateContent"]["companyStatusUpdate"]["share"]["content"]["shortenedUrl"]; var i_c_image = (string)item["updateContent"]["companyStatusUpdate"]["share"]["content"]["submittedImageUrl"]; var i_c_description = (string)item["updateContent"]["companyStatusUpdate"]["share"]["content"]["description"]; var i_c_title = (string)item["updateContent"]["companyStatusUpdate"]["share"]["content"]["title"]; <div style="margin-bottom: 30px;"> <strong>@(i_headline)</strong> <div class="row"> <div class="col-sm-4"> <img src="@(i_c_image)" alt="" class="img-responsive"> </div> <div class="col-sm-8"> @if (!string.IsNullOrWhiteSpace(jsonUpdates) && !string.IsNullOrWhiteSpace(i_c_description)) { <b>@(i_c_title)</b> <p>@(i_c_description)</p> } </div> </div> </div> } } </div> </div> if (!unwrap) { @: </div> } }

Tilmeld dig vores nyhedsbrev

Skabertrang udsender nyhedsbrev 4-6 gange om året med inspiration til din markedsføring og nyheder fra bureauet og branchen.

Det er selvfølgelig muligt at framelde sig igen - men det tror vi ikke, at du får lyst til.