I'm working on an Umbraco project.
I'm using a StandardAnalyzer indexer and I've just added an ArabicAnalyzer indexer.
The fields under <IndexUserFields> haven't been indexed.
part of my ExamineIndex.config file:
<IndexSet SetName="ArabicIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Arabic/" >
<IndexAttributeFields>
<add Name="id" />
<add Name="sortOrder"/>
<add Name="nodeName" EnableSorting="true"/>
</IndexAttributeFields>
<IndexUserFields>
<add Name="_AllContents"/>
<add Name="cityName"/>
<add Name="countryName"/>
</IndexUserFields>
<IncludeNodeTypes>
<add Name="Country" />
<add Name="DestinationInfoTopic" />
<add Name="Article" />
</IncludeNodeTypes>
</IndexSet>
All <IndexAttributeFields> fields are indexed, but <IndexUserFields> aren't, BTW the same fields are indexed using StandardAnalyzer.
Do I need to do something extra in order to index these fields?
After hours of digging finally I found an answer to my problem.
Due to our ArabicAnalyzer usage we must add the indexSet name to the Indexer provider:
<add name="ArabicIndexer"
type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
supportUnpublished="false"
supportProtected="false"
interval="15"
analyzer="Lucene.Net.Analysis.AR.ArabicAnalyzer, Lucene.Net.Contrib.Analyzers"
indexSet="ArabicIndexSet" />
Related
I want to read values of different sections of web.config files.
for e.g.
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" requestValidationMode="4.5"
maxRequestLength="102400" />
<pages validateRequest="true"></pages>
</system.web>
In this system.web section I want to read httpRuntime requestValidationMode
value. In pages I want to read value for validateRequest.
Also, I want to read values of custom headers
<httpProtocol>
<customHeaders>
<add name="X-Content-Type-Options" value="nosniff" />
<add name="X-Frame-Options" value="SAMEORIGIN" />
<remove name="X-Powered-By" />
<add name="X-XSS-Protection" value="1; mode=block" />
</customHeaders>
</httpProtocol>
I believe you want something like this
ConfigurationSection httpProtocolSection =
ConfigurationManager.GetSection("system.webServer/httpProtocol");
ConfigurationElementCollection customHeadersCollection = httpProtocolSection.GetCollection("customHeaders");
For the other values, you have to search for where that value is stored. For example
<compilation debug="true" ...>
is stored here
HttpContext.Current.IsDebuggingEnabled
Many of the section types, additionally, are stored in System.Web.Configuration
System.Web.Configuration.PagesSection
System.Web.Configuration.HttpHandlersSection
And you can retrieve those with GetSection() as well.
I'm having a minor annoyance with VS 2013 when working in ASP.NET MVC Razor views. When typing something like #Html.TextBoxFor(m => m.[PropertyName]), as soon as I type the first m, intellisense pops up a drop down with mbox selected. Then when I press the space key it inserts mbox into my code. Is there anything I can do, besides turning off intellisense, so that I can type my code without having to dismiss the intellisense suggesetion? If I type #Html.TextBoxFor() first, and then go back and fill in the expression, I get the desired behavior, but that is no more convenient.
Edit
I don't have anything imported directly in this view. In the web.configs I have the following:
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
<add namespace="EPiServer.Shell.Web.Mvc.Html" />
<add namespace="EPiServer.Framework.Web.Mvc.Html" />
<add namespace="EPiServer.Web.Mvc.Html" />
<add namespace="LGMVCWeb.ViewModels"/>
<add namespace="LGMVCWeb.Models.Pages.OE"/>
<add namespace="LGMVCWeb.ViewModels.Pages.OE"/>
<add namespace="LGMVCWeb.ViewModels.Shared.OE"/>
I'm trying to setup this sink Serilog.Sinks.Email using xml
<add key="serilog:write-to:Email.restrictedToMinimumLevel" value="Warning" />
<add key="serilog:write-to:Email.from" value="email-from" />
<add key="serilog:write-to:Email.to" value="email-to" />
<add key="serilog:write-to:Email.mailServer" value="mail-server" />
<add key="serilog:write-to:Email.outputTemplate" value="tmpl" />
<add key="serilog:write-to:Email.networkCredential" value="???" />
since networkCredential implements ICredentialsByHost, is possible to specify it using xml?
This is a limitation in the config for the email sink, and/or appsettings support at the moment.
I am reading that in MVC4 to set up simple membership I should do this step:
In the AppSettings include a line:
<add key="enableSimpleMembership" value="true" />
However when I look at the samples generated from the templates they only have:
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
So why do I keep reading it's necessary to set the enableSimpleMembership key?
By default the SimpleMembershipProvider is enabled when you create a new ASP.NET MVC 4 application. But some hosting providers might disable it by overriding this setting in a higher level web.config.
Quote from an article about SimpleMembership:
If you see an error that tells you that a property must be an
instance of ExtendedMembershipProvider, the site might not be
configured to use the ASP.NET Web Pages membership system
(SimpleMembership). This can sometimes occur if a hosting provider's
server is configured differently than your local server. To fix this,
add the following element to the site's Web.config file:
<appSettings>
<add key="enableSimpleMembership" value="true" />
</appSettings>
This setting is used by the WebMatrix.WebData.PreApplicationStartCode method which executes automatically when your site runs and will use the value of this setting to enable the simple membership provider.
Actually configuring the SimpleMembershipProvider explicitly is what I would recommend you:
<membership defaultProvider="SimpleMembershipProvider">
<providers>
<clear/>
<add name="SimpleMembershipProvider"
type="WebMatrix.WebData.SimpleMembershipProvider, WebMatrix.WebData"/>
</providers>
</membership>
<roleManager enabled="true" defaultProvider="SimpleRoleProvider">
<providers>
<clear/>
<add name="SimpleRoleProvider" type="WebMatrix.WebData.SimpleRoleProvider, WebMatrix.WebData"/>
</providers>
</roleManager>
Now, there's no room for confusion anymore. Both the membership and role providers are configured explicitly.
im currently trying to implement a profile provider for my site a few days now and having a hard time working on it, im a php programer and i just shift to asp.net recently
Im using Linq to sql and follow this http://www.codeproject.com/KB/aspnet/LINQCustomProfileProvider.aspx tutorial.
the reason im using my own because i having different structure than any default of asp.net have. The profile data is inside my user table.
The compile was fine, login was fine.
but i tried
<% CMSProfile profile = HttpContext.Current.Profile as CMSProfile;%>
<%= profile.NickName %>
it won't work and throw me a System.NullReferenceException...
so how can i automatically get my Profile into the HTTPCONtext so that i can call out easily everytime.
If you need any more data, i can provide.
Thank you very much.
Web.config:
<roleManager enabled="false" defaultProvider="CMSRoleProvider">
<providers>
<clear />
<add name="CMSRoleProvider" type="P014.ProviderClass.CMSRoleProvider" connectionStringName="P014ConnectionString" applicationName="/" />
</providers>
</roleManager>
How have you registered the provider in web.config? You shouldn't have to instantiate the provider yourself it should be done by the app at startup. If you give more info I might be able to help.
EDIT: Here is my web.config, maybe it will be of help to you.
<profile defaultProvider="SWIntranetProfile" enabled="true">
<providers>
<clear/>
<add name="SWIntranetProfile" type="SWIntranetProfile"/>
</providers>
<properties>
<clear/>
<!-- SID is really LOGON_USER -->
<add name="SID" allowAnonymous="false" type="System.String" readOnly="true"/>
<add name="PersonID" allowAnonymous="false" type="System.Int32" readOnly="true"/>
<add name="EmailAddress" allowAnonymous="false" type="System.String" readOnly="true"/>
<add name="Position" allowAnonymous="false" type="System.String" readOnly="true"/>
<add name="Name" allowAnonymous="false" type="System.String" readOnly="true"/>
<add name="FirstName" allowAnonymous="false" type="System.String" readOnly="true"/>
<add name="LastName" allowAnonymous="false" type="System.String" readOnly="true"/>
<add name="ImageName" allowAnonymous="false" type="System.String" readOnly="true"/>
<add name="PhoneExt" allowAnonymous="false" type="System.String" readOnly="true"/>
<add name="LastIP" allowAnonymous="false" type="System.String" readOnly="false"/>
<add name="IntranetTheme" allowAnonymous="false" type="System.String" readOnly="false"/>
<add name="UnionID" allowAnonymous="false" type="System.Int32" readOnly="true"/>
<add name="UnionName" allowAnonymous="false" type="System.String" readOnly="true"/>
<add name="OfficeID" allowAnonymous="false" type="System.Int32" readOnly="true"/>
</properties>
</profile>
I noticed that the author of the article didn't give a code sample for binding the profiler or Workflow to the HttpContext.
Have you written your own class to do this? If so, have you set this up correctly in the web.config?
If your using IIS7 you also need to register your IHttpModule under the webServer section of the web.config file.
EDIT
To be able to run the code snippet you have show to you need to have placed your custom Profiler to the HttpContext.
You can do this in two ways, either on a per request basis or on the application start.
For the per request basis you would need to create a class that implements IHttpModule and register it in the web.config.
For the Application start you need to attach your CMSProfile to the HttpContext.Current in the Application_OnStart method.
Their is a sample application attached to the article you posted, have you downloading and checked sample application?