episerver

Diamonds with question marks

自作多情 提交于 2021-02-04 18:58:07
问题 I'm getting these little diamonds with question marks in them in my HTML attributes when I present data from my database. I'm using EPiServer and a few custom properties. This is the information I've gathered, I save my data as a XML document, since I use custom EPiServer properties which need more than one defined value. This is saved as UTF8. It's only attributes in element tags which have this problem, such as align=left becomes align=�left�. There is no " character there, but I get the

EpiServer - How can I find out if a block is being used on any published page?

北慕城南 提交于 2021-01-28 06:47:26
问题 I have an episerver project that has lots of blocks over time some of these blocks are no longer needed, is there a way to see if a created block is being used on any pages in my episerver website? 回答1: I rarely do this but last time I did I used this code to get all published instances of a custom CodeBlock // initiate the repos (use dependency injection instead of the ServiceLocator) var contentTypeRepository = ServiceLocator.Current.GetInstance<EPiServer.DataAbstraction

Truncating Xhtmlstring in Episerver

∥☆過路亽.° 提交于 2020-06-26 04:00:11
问题 I'd need to get a html friendly version of a truncated Xhtmlstring as the tag endings might get clipped when truncated. Any ideas on how to achieve this? I've thought of just getting rid of all tags first and then clipping but is there a solution for this inside episerver or is this just basic string-manipulation with regex? 回答1: There is a built-in helper function in the TextIndexer class called StripHtml which can be used to remove any tags to end up with plain text before truncating: var

Using Recaptcha with EPiServer XForms

百般思念 提交于 2020-01-24 17:40:27
问题 Does any one have experiense of using Recaptcha with XForms in EPiServer? I don't know where to put the Recaptcha control and how to make it work. The sample code for ASP.NET is the code below. Where should i put it. My guess is in the FormControl_BeforeSubmitPostedData ? <%@ Page Language="VB" %> <%@ Register TagPrefix="recaptcha" Namespace="Recaptcha" Assembly="Recaptcha" %> <script runat=server%gt; Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs) If Page.IsValid Then

EpiServer Web service 6.0, problems authenticating when using webservice

妖精的绣舞 提交于 2020-01-06 08:56:48
问题 I'm doing a console applications that will tell the EpiServer webservice to add a page. My problem is that I can't get the autentication to work. I've created a webservice user in Epi backofice. I can login to the webservice through the browser with my account. A code sample from the console app is as follows. var client2 = new ContentChannel.ContentChannelServiceSoapClient(); client2.ClientCredentials.UserName.UserName = "username"; client2.ClientCredentials.UserName.Password = "password";

EpiServer - Add block to a content area programmatically

大憨熊 提交于 2019-12-30 09:09:11
问题 I have a content area which will have some blocks, some attributes of these blocks must be initialized with data from a SQL query, so in the controller I have something like this: foreach (ObjectType item in MyList) { BlockData currentObject = new BlockData { BlockDataProperty1 = item.ItemProperty1, BlockDataProperty2 = item.ItemProperty2 }; /*Dont know what to do here*/ } What I need, is to work with currentObject as a block, and add it to a content area I have defined in another block. I

EpiServer - Add block to a content area programmatically

冷暖自知 提交于 2019-12-30 09:08:14
问题 I have a content area which will have some blocks, some attributes of these blocks must be initialized with data from a SQL query, so in the controller I have something like this: foreach (ObjectType item in MyList) { BlockData currentObject = new BlockData { BlockDataProperty1 = item.ItemProperty1, BlockDataProperty2 = item.ItemProperty2 }; /*Dont know what to do here*/ } What I need, is to work with currentObject as a block, and add it to a content area I have defined in another block. I

What are the steps to creating a new EPiServer Project

て烟熏妆下的殇ゞ 提交于 2019-12-23 19:35:12
问题 How do you go about setting up a new EPiServer website? I can't seem to get from an empty visual studio project to a deployed website without having to fix all kinds of file path and referencing issues. If you have a smooth process for creating an EPiServer site from scratch and deploying it to a web server... I'd love to hear it! 回答1: When I started out with EPiServer, I found this blog series to be extremely helpfull! 回答2: Setup a framework site that you fix, maintain and add general stuff

Getting particular property value from particular page in episerver

瘦欲@ 提交于 2019-12-23 02:57:28
问题 I need to get the property value for user given property of user given page in episerver... for that i write a method.. public string GetContent(string pageName, string propertyName) { var contentTypeRepo = ServiceLocator.Current.GetInstance<IContentTypeRepository>(); IEnumerable<ContentType> allPageTypes = contentTypeRepo.List(); var currentpage = allPageTypes.Where(x => x.Name.ToLower() == pageName); var pageId = currentpage.First().ID; var pageRef = new PageReference(pageId); var

How to differentiate if the current page is an EPiServer Page or not

╄→尐↘猪︶ㄣ 提交于 2019-12-23 01:45:37
问题 I need to know if the current page is an EpiServer page or not. I need to know if the current page is the start page, I am using the following line of code. if(PageReference.StartPage.ID == CurrentPage.PageLink.ID) This works perfect on all EPiServers, but when I am on a non EPiServer page then CurrentPage returns values for the StarPage. This means that all my non-EPiServer pages are treated as a StartPage (just in my if statement of course). One solution I thought of is to check first if