Tabish Usman

Total Ranking points:3475

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 Hi , As per my understanding it is security/unauthorized user performing the action related issue so to fix it you need to make two changes to your code. 1) you need to surround your code with enabling the "SuppressSecurityChecks" to give rights to your librariesManager to perform your librariesManager related operation by using the following lines where first line to enable and second line to disable the "SuppressSecurityChecks" at the starting and ending of the method. librariesManager.Provider.SuppressSecurityChecks = true; librariesManager.Provider.SuppressSecurityChecks = false; 2) secondly as you are directly using "WorkflowManager" you need to replace that line with the following line of code to give rights to the "WorkflowManager" to perform the required action SystemManager.RunWithElevatedPrivilege(d => { WorkflowManager.MessageWorkflow(documentId, typeof(Document), null, "Publish", false, bag); }); So Now your final updated method for the purpose will look like the following one public static void CreateDocumentNativeAPI(Guid masterDocumentId, string parentDocumentLibraryUrlName, string documentTitle, Stream documentStream, string documentFileName, string documentExtension) { LibrariesManager librariesManager = LibrariesManager.GetManager(); librariesManager.Provider.SuppressSecurityChecks = true; Document document = librariesManager.GetDocuments().Where(d => d.Id == masterDocumentId).FirstOrDefault(); if (document == null) { document = librariesManager.CreateDocument(masterDocumentId); DocumentLibrary documentLibrary = librariesManager.GetDocumentLibraries().Where(d => d.UrlName.ToLower() == parentDocumentLibraryUrlName).SingleOrDefault(); document.Parent = documentLibrary; document.Title = documentTitle; document.DateCreated = DateTime.UtcNow; document.PublicationDate = DateTime.UtcNow; document.LastModified = DateTime.UtcNow; document.UrlName = Regex.Replace(documentTitle.ToLower(), @"[^\w\-\!\$\'\(\)\=\@\d_]+", "-"); document.MediaFileUrlName = Regex.Replace(documentFileName.ToLower(), @"[^\w\-\!\$\'\(\)\=\@\d_]+", "-"); librariesManager.RecompileAndValidateUrls(document); librariesManager.Upload(document, documentStream, documentExtension); librariesManager.SaveChanges(); var bag = new Dictionary<string, string>(); bag.Add("ContentType", typeof(Document).FullName); SystemManager.RunWithElevatedPrivilege(d => { WorkflowManager.MessageWorkflow(documentId, typeof(Document), null, "Publish", false, bag); }); } librariesManager.Provider.SuppressSecurityChecks = false; }

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", "DO_NOT_TRUST_SitecoreFundamentalsRoot" 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! Updated: Note: This issue generally appear because of the old certificates available in these locations against some previous installation

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);

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

30 Asp.Net

30 C#


18 CMS

16 Sitecore

10 Sitecore 9

9 IIS (Internet Information Services)



6 Microsoft Visual Studio