Posts

Control Webpart Visible/Enable using macro in Kentico

Image
Simple post just to show how you can enable or visible the webpart in certain page. This is basically to avoid using many template. You can use only one template that have many webpart, and you can control visible/enable it using macro. Macro Code {% if(NodeAlias == "Search") {    return true; } else {  return false; } %} By Mohd Zulkamal NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

How to track download file analytics in Kentico 7

Let say you create one Document Type in Kentico CMS, and inside the document type got one field for attachment. So you want to track/count how many time the document download using Web Analytic feature in Kentico. First of all you need to enable the web analytic feature in  Kentico. Follow this link to read more about web analytic in kentico. Here is the solution to track/count download file for a DocumentType Field. A bit of customization is required to track all the downloaded files. The problem is that only CMS.File document type downloads are tracked by default. However, you can change that by going to the file: \CMSPages\GetFile.aspx.cs Within this file, around line 1268 or Find method LogEvent there is the following condition: if (IsLiveSite && (file.FileNode != null) && (file.FileNode.NodeClassName.ToLower() == "cms.file")) You have to alter it to the following one so all files are logged, not only files attached to a CMS.File document: if (IsLiveSite...

Create Navigation Using Kentico 7 Repeater Webpart

Image
Kentico CMS for ASP.NET empowers marketers and developers in creating websites without limits. It's the ultimate solution for your website, store, community and on-line marketing initiatives. Today i want to show how you can use Repeater Webpart to create one Navigation. On this post i will more focus on the Transformation . Let say this is your navigation html code : Navigation Html Code <ul class="megamenu">    <li>     <a href="#_" class="megamenu_drop">LEVEL ONE</a>     <div class="dropdown_3columns dropdown_container">       <ul class="dropdown_flyout">         <li class="dropdown_parent">           <a href="#_">LEVEL TWO</a>           <ul class="dropdown_flyout_level">            ...

Tips to Improve LINQ to SQL Performance

LINQ to SQL is a powerful technology that can do as much harm as good if it is mis-used. Here is how to get more out of your LINQ to SQL efforts. Tip 1: Ditch the Extra Baggage with ObjectTrackingEnabled  LINQ to SQL, by default, behaves like it's going on a every possibility. It carries every provision it thinks it'll ever need, and your application carries that extra weight. If you know you're only going for a short hike, why not tell it to leave the pack at home? That's where the ObjectTrackingEnabled property of the DataContext comes in. By default this property is true , which causes LINQ to SQL to keep track of every change you make to your data in case you want to save those changes later. If you know you're only reading data and won't be changing it, I suggest setting this property to false. Then all of that change-tracking overhead goes away. The performance boost does come at a small price, however. Deferred loading will no longer work. You'll have...

How to splitting huge ViewState size

When the ViewState in your page becomes very large it can be a problem since some firewalls and proxies will prevent access to pages containing huge ViewState sizes. For this purpose ASP.NET introduces the ViewState Chunking mechanism. So ASP.NET enables splitting of the ViewState's single hidden field into several using the MaxPageStateFieldLength property in the web.config section. When the MaxPageStateFieldLength property is set to a positive number, the view state sent to the client browser is broken into multiple hidden fields. Setting the MaxPageStateFieldLength property to a negative number (the default) indicates that the view-state field should not be separated into chunks. Setting the MaxPageStateFieldLength to a small number may result in poor performance. Sample ViewState before: <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"value="/wEPDwUKLTk2Njk3OTQxNg9kFgICAw9kFgICCQ88KwANAGQYAQUJR3Jp ZFZpZXcxD2dk4sjERFfnDXV/hMFGAL10HQU...

How to disable asp.net version and server information on HTTP Headers

Image
Scenario: We identified that the target web server is disclosing the ASP.NET version in its HTTP response. This information might help an attacker gain a greater understanding of the systems in use and potentially develop further attacks targeted at the specific version of ASP.NET. Impact: An attacker might use the disclosed information to harvest specific security vulnerabilities for the version identified. Solution Disable the asp.net version and server information on http headers. Open the web.config file and add this code in the web.config file : <system.webServer>     <httpProtocol>         <customHeaders>             <remove name="Server" />             <remove name="X-AspNet-Version" />             <remove name="X-AspNetMvc-Version" /...

How to disable httpOnlyCookies - asp.net

Scenario HTTP only cookies cannot be read by client-side script therefore marking a cookie as HTTP only can provide an additional layer of protection against cross-site script attack. Impact: During Cross-Site scripting attack and attacker might easily access cookies and hijack the victim’s session. Solution You can disable the httpOnlyCookies on the web.config file. Open the web.config file and add the configuration on the httpCookies element like example below : <system.web> : : <httpCookies httpOnlyCookies="false" requireSSL="false" domain="" /> : :  </system.web> By Mohd Zulkamal NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)