Tabish Usman

Total Ranking points:3265

Top Questions

5 Sitecore 10 Installation Error: Failed to Start Service 'Sitecore Marketing Automation Engine' while another instance of sitecore 9.0.2 also running on my system

4 Sitefinity's Default list (mvc) widget disappeared on news details page?

3 What could be the best way to make one site’s code independent of other while using sitecore multisite with helix code architecture?

Top Answers

8 To Completely remove TFS source control binding follow the two steps: 1)Go to your solution's folder,find and delete all files with *.vssscc and *.vspscc extensions. 2)open your solution's .sln file in notepad find and remove this "GlobalSection(TeamFoundationVersionControl)" section. Reference Link

7 I have also faced similar kind of issue ,I have resolved this WebGrease version issue by executing the following commands in the package manager console. Install-Package Microsoft.AspNet.Web.Optimization Update-Package WebGrease Uninstall-Package Microsoft.AspNet.Web.Optimization Uninstall-Package WebGrease Install-Package Microsoft.AspNet.Web.Optimization Update-Package WebGrease

6 The simplest way I found on web to generate such dynamic sitemap using mvc is following a three steps procedure in which we just need to create two classes and a controller method. Step 1 – Create A CustomSitemapItem Class The CustomSitemapItem Class will be used to store all the properties we need for each sitemap URL entry. public class CustomSitemapItem { public DateTime? DateAdded { get; set; } public string URL { get; set; } public string Priority { get; set; } } Step 2 – Create A CustomSitemapActionResult public class CustomSitemapActionResult : ActionResult { private List<CustomSitemapItem> _SitemapItems; private string _Website; public CustomSitemapActionResult(List<CustomSitemapItem> SitemapItems, string Website) { this._SitemapItems = SitemapItems; this._Website = Website; } public override void ExecuteResult(ControllerContext context) { context.HttpContext.Response.ContentType = "text/xml"; using (XmlWriter writer = XmlWriter.Create(context.HttpContext.Response.Output)) { writer.WriteStartElement("urlset", ""); foreach (var SiteMapItem in this._SitemapItems) { writer.WriteStartElement("url"); writer.WriteElementString("loc", string.Format(this._Website + "{0}", SiteMapItem.URL)); if (SiteMapItem.DateAdded != null) { writer.WriteElementString("lastmod", string.Format("{0:yyyy-MM-dd}", SiteMapItem.DateAdded)); } writer.WriteElementString("changefreq", "daily"); writer.WriteElementString("priority", SiteMapItem.Priority); writer.WriteEndElement(); } writer.WriteEndElement(); writer.Flush(); writer.Close(); } } } The CustomSitemapActionResult is the result that comes back from the controller when the URL /sitemap is called. It takes a list of CustomSitemapItem classes and generates the corresponding xml file that will be used by different search engines to index your website. Step 3 – Create A Sitemap Controller Method The controller is where you will generate your list of CustomSitemapItem classes that will be returned via the CustomSitemapActionResult [OutputCache(Duration = 120, VaryByParam = "none")] public CustomSitemapActionResult Sitemap() { var Website = ""; var currentdate = DateTime.Now; var SitemapItems = new List<CustomSitemapItem>(); //Static items will be added as follows SitemapItems.Add(new CustomSitemapItem { URL = "", Priority = "1", DateAdded = currentdate }); SitemapItems.Add(new CustomSitemapItem { URL = "/about", Priority = ".9", DateAdded = currentdate }); SitemapItems.Add(new CustomSitemapItem { URL = "/contact", Priority = ".9", DateAdded = currentdate }); SitemapItems.Add(new CustomSitemapItem { URL = "/terms-and-condition", Priority = ".9", DateAdded = currentdate }); //Dynamic items will be added as follows var allNews = News.GetWithAllStatus().Where(t => t.Status == Status.Active); foreach (var item in allNews) { int totalCount = 0; SitemapItems.Add(new CustomSitemapItem { URL = "/News/" + item.UrlName, Priority = ".8", DateAdded = item.DateCreated }); } //Dynamic items will be added as follows var allBlogPosts = BlogPosts.GetWithAllStatus().Where(p => p.Status == Status.Active); foreach (var item in allBlogPosts) { SitemapItems.Add(new CustomSitemapItem { URL = "/Blogpost/" + item.UrlName, Priority = ".8", DateAdded =item.DateCreated }); } return new CustomSitemapActionResult(SitemapItems, Website); } That’s it now you can simply use the controller method Sitemap() to get your sitemap xml.

5 This issue is with all versions of sitecore above 9.1 containing the sitecore identity to login. To fix this you need to perform following three steps 1) Create a config file and paste the below chunk of code into that file and name it as "z.unicorn.fix.config". <configuration> <sitecore> <pipelines> <owin.cookieAuthentication.validateIdentity> <processor type="Sitecore.Owin.Authentication.Pipelines.CookieAuthentication.ValidateIdentity.ValidateSiteNeutralPaths, Sitecore.Owin.Authentication"> <siteNeutralPaths hint="list"> <path hint="unicorn">/unicorn.aspx</path> </siteNeutralPaths> </processor> </owin.cookieAuthentication.validateIdentity> </pipelines> </sitecore> </configuration> 2)Place this file under your include folder of Unicorn for example following location: <Project-root-path>\App_Config\Include\Unicorn 3)Now restart your IIS site and go to Unicorn control panel to verify the fix.

5 By looking at the error it seems that you have older version of unicorn in your repository because it is trying to access a method which is not available in later versions, now to fix this one you need to remove the older version of unicorn from your instance. For removing the unicorn you need to remove all the unicorn related .dll files ( e.g ranbow.*.dll, unicorn.*.dll, configy.dll and Kamsar.WebConsole.dll ) from your bin folder and also you need to remove relevant config files as well.

5 Finally the issue has been resolved for me and in my case what actually solves the problem was to remove all certificates named "DO_NOT_TRUST_SitecoreRootCert", "Sitecore Install Framework" from following two locations. -Trusted Root Certification Authorities -Intermediate Certification Authorities Then tried running the script once again with different instance name and it worked successfully!

5 Recently I have gone through to a similar issue and found out to be an issue of visual studio update! So to resolve it you need to go to Control Panel --> Programs and Features and select your visual studio and update it. That update will take time in my case it was of around 1.6 GB. Note: it will require a system restart at the end.

5 I have also gone through the same problem and what I realize after some research on the error that there are two versions of "DacFramework" I have installed "EN\x64\DacFramework.msi" but missed "EN\x86\DacFramework.msi" one. We need to install both x64 and x86 , for the purpose you can goto that link and click on "click here to download manually" where you can check and download both("EN\x64\DacFramework.msi", "EN\x86\DacFramework.msi") and install both .msi files, thats it try runing your script again that should work.

5 Hi, The code provided by Peter will update the stored procedure but it also adds WITH RECOMPILE to the stored procedure as well which is obviously unwanted addition, so I recommend to do it by sending the complete query batch using SqlClient. For the purpose you can use the following method. public void ExecuteNonQueryBatch(string connectionString, string sqlStatements) { if (sqlStatements == null) throw new ArgumentNullException("sqlStatements"); if (connectionString == null) throw new ArgumentNullException("connectionString"); using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); Regex r = new Regex(@"^(\s|\t)*go(\s\t)?.*", RegexOptions.Multiline | RegexOptions.IgnoreCase); foreach (string s in r.Split(sqlStatements)) { //Skip empty statements, in case of a GO and trailing blanks or something string thisStatement = s.Trim(); if (String.IsNullOrEmpty(thisStatement)) continue; using (SqlCommand cmd = new SqlCommand(thisStatement, connection)) { cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); } } } } To make the above updates to the stored procedure you can call the method as shown below. string strSQLStatements = @"ALTER PROCEDURE [dbo].[SelectCustomers] AS BEGIN SELECT * from Customer where Customer.Status=1 order by Customer.DateCreated DESC END"; ExecuteNonQueryBatch("YourConnectionString", strSQLStatements);

5 Value Type: A value type derives from System.ValueType and stores its contents in memory allocated on the stack. When you created a Value Type, a single space in memory is allocated to store the value and that variable directly holds a value. If you assign it to another variable, the value is copied directly and both variables work independently. Value types can be created at compile time and Stored in stack memory, because of this, Garbage collector can't access the stack. Some Value Types are: -bool -byte -char -decimal -double -enum -float -int -long -sbyte -short -struct -uint -ulong -ushort Reference Type: A reference type extends System.Object and used by a reference which holds a reference (address) to the object but not the object itself. Because reference types represent the address of the variable rather than the data itself, assigning a reference variable to another doesn't copy the data. Instead it creates a second copy of the reference, which refers to the same location of the heap as the original value. Reference Type variables are stored in a different area of memory called the heap. This means that when a reference type variable is no longer used, it can be marked for garbage collection. Some Reference Types are: -String -All arrays, even if their elements are value types -Class -Delegates -Indexers -Interfaces Now for further explanation I have created a simple console application which will help you understand the difference in terms of usage. Code example: using System; public class Program { public static void Main() { MyClass mc=new MyClass(); mc.Number=100; int number=100; ChangeValueTypeValue(number); ChangeReferenceTypeValue(mc); Console.WriteLine("ValueType="+number); Console.WriteLine("ReferenceType="+mc.Number); } public static void ChangeValueTypeValue(int num ){ num=num+10; Console.WriteLine("ValueType Inside the method="+ num); } public static void ChangeReferenceTypeValue(MyClass myclass){ myclass.Number=myclass.Number+10; } } public class MyClass { public int Number; } Above code’s output will be as follows: ValueType Inside the method=110; ValueType=100; ReferenceType=110; Now to get more clarity regarding the above code and its output, what happens here(for value type) is that value type created the copy of the variable with actual data which will work independently, when we have incremented the value inside the method that incremented value has the scope inside the method only. So when we have printed the value inside the method it has been printed as incremented value (110) and when we have printed it outside the method it actually printed the original variable’s value which was 100. While on the other hand reference type created the copy of the variable which holds the address of another memory location containing the actual data so both copies points to the same data, So when we have incremented the value it actually incremented the value which is shared among both variable (the original one and the copy) and now when we have printed the value for reference type it displayed the incremented value as 110.

Top Tags Created

3 ASP.NET Web Forms

2 Firefox

2 React.js

1 race condition

1 Sitecore® Helix

1 Sitecore Multisite Architecture

1 Sitecore Identity

Top Tags Used

29 Asp.Net

28 C#


16 CMS

15 Sitecore

9 Sitecore 9

8 IIS (Internet Information Services)



6 Microsoft Visual Studio