Error executing template "/Designs/LV/Paragraph/LeysStorvPlugin_ShowJob.cshtml"
System.Net.WebException: The operation has timed out
   at System.Net.HttpWebRequest.GetResponse()
   at CompiledRazorTemplates.Dynamic.RazorEngine_53d365c45f304c099e6bd3f7208fc5bd.Execute() in E:\Dynamicweb.net\Solutions\landsverk.live\Files\Templates\Designs\LV\Paragraph\LeysStorvPlugin_ShowJob.cshtml:line 22
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @using System.Xml.Linq 2 @using System.Xml 3 @using System.Linq 4 @using System.Web 5 @using System.Net 6 @using System.Text.RegularExpressions; 7 @using System.IO; 8 9 10 <div class="container"> 11 <div class="row"> 12 13 14 15 @{ 16 string fbimgstr=""; 17 int lscount=0; 18 HttpWebRequest rq = WebRequest.Create("https://starvssetan.landsverk.fo/REK/joblistxml.asmx/GetJobList?JobListId=1&Language=fo") as HttpWebRequest; 19 //3 Second Timeout 20 rq.Timeout = 3000; 21 //Also note you can set the Proxy property here if required; sometimes it is, especially if you are behind a firewall - rq.Proxy = new WebProxy("proxy_address"); 22 HttpWebResponse response = rq.GetResponse() as HttpWebResponse; 23 24 25 XmlTextReader reader = new XmlTextReader(response.GetResponseStream()); 26 27 XmlDocument xml = new XmlDocument(); 28 xml.Load(reader); 29 XmlNodeList nodes = xml.SelectNodes("//JobOffer"); 30 string jeid=HttpContext.Current.Request.QueryString["jobofferentityid"]; 31 <text> 32 @if(String.IsNullOrEmpty(@jeid)){ 33 34 jeid=HttpContext.Current.Request.QueryString["jobOfferInstanceId"]; 35 } 36 </text> 37 38 } 39 40 @foreach(XmlNode node in nodes) 41 { 42 string jobid = node.SelectSingleNode("JobOfferInstanceId").InnerText; 43 var besk = node.SelectSingleNode("Description").InnerText; 44 var joburl = node.SelectSingleNode("ShowJobUrl").InnerText; 45 var jobtitle = node.SelectSingleNode("JobTitle").InnerText; 46 var applylink = node.SelectSingleNode("ApplyForJobUrl").InnerText; 47 var jobimg = node.SelectSingleNode("ShortDescription").InnerText; 48 string strRegex = @"(?<=src="").*?(?="")"; 49 Regex srcRegex = new Regex(strRegex); 50 string strTargetString = besk.ToString(); 51 string srcElement = srcRegex.Match(strTargetString).Value; // SRC 52 srcElement=HttpUtility.UrlPathEncode(@srcElement); 53 54 if(!String.IsNullOrEmpty(@jobimg)){ 55 fbimgstr=jobimg; 56 } 57 if(jobid==jeid) { 58 59 60 <text> 61 @{ 62 63 string ogdesc=Regex.Replace(@besk, @"<[^>]*>", String.Empty); 64 } 65 66 @SnippetStart("FBimg") 67 <meta property="og:title" content="@jobtitle"> 68 <meta property="og:description" content="@ogdesc.Substring(0,700)..."> 69 70 <meta property="og:image" content="@srcElement" /> 71 72 @SnippetEnd("FBimg") 73 <script> 74 75 76 document.addEventListener("DOMContentLoaded", function(event) { 77 78 $('title').html("@jobtitle"); 79 80 }); 81 </script> 82 83 </text> 84 <text> <div class="col-md-8 showjoboffer"> 85 <h1 class="jobtitle">@jobtitle</h1> 86 <img class="jobicon" src="/Files/Images/Um okkum/Starvslysingar/@jobimg" /> 87 <div class="jobdesc">@besk</div> 88 </div> 89 90 <div class="col-md-3 col-md-offset-1 applyforjob"> 91 <a class="round right-float" href="#" style="margin-top:25px; margin-bottom:30px;" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href),'facebook-share-dialog','width=626,height=436');return false;"><span class="ti-facebook"></span></a> 92 93 <a class="applyjoblink" target="_blank" style="margin-top:15px !important;" href="@applylink">Send umsókn<span class="ti-arrow-right"></span></a> 94 95 </div> 96 </text>} 97 98 99 lscount++; 100 101 } 102 @if(lscount==0){<text>Einki leyst starv í løtuni</text>} 103 </div></div>
Úrslit: