tag:blogger.com,1999:blog-5567315752615858022024-02-02T15:58:26.077+05:30Prashant's BlogBlog about my work and life experiencePrashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.comBlogger104125tag:blogger.com,1999:blog-556731575261585802.post-50577200992610767702018-11-14T10:41:00.000+05:302018-11-14T10:41:16.651+05:30My Goodreads - Reading Challenge 2018I registered to <a href="https://en.wikipedia.org/wiki/Goodreads" rel="nofollow" target="_blank">Goodreads</a> couple of yours back out of curiosity and started to actively reading books in 2016 and 2017 but was just struggling to allocate enough time to regularly read. At the very end of 2017, I found about reading challenge in <a href="https://en.wikipedia.org/wiki/Goodreads" rel="nofollow" target="_blank">Goodreads</a> and opt in for the reading challenge of 2018 to read 8 books. I shortlisted books before 2018 started and bought paper back copies of first three books before new year starts.<br />
<br />
<h3>
Was it difficult?</h3>
Well, I admit it was difficult. Taking a challenge builds pressure on you and its not good to add another reason to stress out yourself when you have so many of them already! All I focused to think was to try look for suitable time to read and always keep a book with me in my bag. Its okay if I do not finish the challenge but at least I would be able to read some books or in a worst case pages.<br />
<br />
There were times when I was moving along with the book in my bag and did not read any single page in weeks. At times the books that I chose seems to be boring, so I had to pause with that book and switch over to other ones. I talked about my challenges to lot many people in office and friend circle so that they keep asking me about the progress.<br />
<br />
All these things helped but it was still difficult to finish 8 books.<br />
<br />
<a href="https://www.goodreads.com/user_challenges/10652962" target="_blank">Here are books that I completed</a>. Feel free to react on the challenge if you have good reads account.<br />
<br />
<br />
<h3>
What's the catch?</h3>
In the beginning I started with some of the big and lengthy books. Based on the time left in the year, I just adjusted my reading list with some small books that I wanted to read out of my big list of books. You will see In search of excellence, thinking fast and slow etc are big books with heavy concepts that takes time to understand. As the year progressed, I just picked up small books like zero to one and I cheated by adding Sea Prayer which is just a picture book that hardly takes 20mins to read.<br />
<br />
<h3>
Join in, let's try it in 2019</h3>
As we are heading towards 2019, I will be taking up Goodreads Reading challenge to read 10 books this time. Do you want to join in? Let's do it together!<br />
<br />
P.S. - I am in Ahmedabad and all my books are available to be borrowed free of cost for reading. <br />
<br />
<br />
<br />
<br />
<br />
<br />Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-83241583396371397072017-09-02T16:50:00.002+05:302017-09-02T16:52:39.661+05:30Leadership in software development - At Level 1<a href="http://www.johnmaxwell.com/" rel="nofollow" target="_blank">John Maxwell</a> has described <a href="http://www.johnmaxwell.com/blog/5-levels-of-leadership" rel="nofollow" target="_blank">5 levels of leadership</a> which help leaders in any business domain to understand where they are and where to go from there. His book "<a href="https://books.google.co.in/books/about/The_5_Levels_of_Leadership.html?id=7UI5AQAAQBAJ&source=kp_cover&redir_esc=y" rel="nofollow" target="_blank">The 5 Levels of Leadership: Proven Steps to Maximize Your Potential</a>" covers the levels in much more details with example. In this article, I will share what I have learned from my experiences and challenges I faced during my Level 1 of leadership and how I was able to make it through to next level.<br />
<h3>
How you make team feel?</h3>
Being a newly introduced leader, team will not be knowing you beyond a formal introduction. Communications and action during initial days are most important and here is what is recommended.<br />
<ul>
<li><b>Be a curious listener</b> and allow your team members to speak. </li>
<li>Do not provide solutions right away. Make sure that its just information that do not require action, a general complain that requires taking note or a problematic situation where immediate action from your end is required.</li>
<li>Do not talk about your expertise, experiences etc to show you are right person to solve their problems. Instead, take appropriate actions, solve the in hand problem in your responsibility and thank the team for helping you. Actions influence the team more than talking!</li>
</ul>
By having you in the team, they should start feeling more empower, supported and capable.<br />
<h3>
Focus on basics</h3>
Being a leader of any software development team, you must understand what they work on daily basis and how they accomplish expected output with very good details and here is what is recommended.<br />
<ul>
<li>Know <b>what work means</b> in your team and how everybody feels about the timelines, deliveries and output (productivity + quality) expected. </li>
<li>Know what is maturity level of must have basic processes that can help them.</li>
<li>Do not criticize or change anything unless you understand WHY they follow existing processes. Ask WHY to the team and listen to them carefully.</li>
<li>Do not start changing anything until you fully monitor and understand full set of followed processes for several time.</li>
</ul>
By having you in the team, when team talks to you about work, you should be able to fully understand it. Even if you cannot solve all their problems as a new leader, listening and understanding their problems will help you a lot build confidence and trust in the team.<br />
<br />
<h3>
Ask how can you help? </h3>
There are times when team is busy doing their regular work disconnected from you. Visit them at least once in a day asking how they are dong with their work and if you can you help with something. This will give a clear message that you are available to them and open to help.<br />
<h3>
Appreciate</h3>
Keep an eye on smallest achievements of the team and make them feel proud by doing a quick team meeting. Give credit to full team work and celebrate by clapping and appreciating all hard work that has been done by the full team.<br />
<br />
In my experience, periodic round of appreciation always motivate people to create a great team bonding. People will prefer to help each other more, crave to achieve more and work harder to receive more of these kind of achievements.<br />
<br />
<h3>
Conclusion </h3>
Being at Level 1 is exciting! You are full of energy, learning initial lessons of leadership and working hard towards moving forward to level 2! Hope this quick tips will help you! Feel feel to share your ideas and experience on the same by putting comments below!<br />
<br />
Stay in touch & Good luck with your journey of leadership!Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-49041090708884510182016-10-12T16:55:00.000+05:302016-10-12T16:55:05.469+05:30How to create certificate for any domain from free certificate authority<h2>
<span style="font-family: "Trebuchet MS",sans-serif;">Before we start</span></h2>
<span style="font-family: "Trebuchet MS",sans-serif;">Before we start we will need the domain/sub domain for which you want to generate https certificate is up and running on http. </span><br />
<h2>
<span style="font-family: "Trebuchet MS",sans-serif;">Get Certificate, Key and CA Certificate</span></h2>
<ol>
<li><span style="font-family: "Trebuchet MS",sans-serif;">Goto https://www.sslforfree.com/ and enter your domain/sub domain and click on Create Free SSL Certificate</span></li>
<li><span style="font-family: "Trebuchet MS",sans-serif;">Click on "Manual Verification" and then "Manually Verify Domain"</span></li>
<li><span style="font-family: "Trebuchet MS",sans-serif;">download the file "Download File #1" and upload it to specified path</span></li>
<li><span style="font-family: "Trebuchet MS",sans-serif;">Click on download certificate and download certificate, key and ca certificate.</span></li>
<li><span style="font-family: "Trebuchet MS",sans-serif;">download openssl for windows from http://slproweb.com/products/Win32OpenSSL.html</span></li>
<li><span style="font-family: "Trebuchet MS",sans-serif;">put your certificate and key in bin directory of openssl installation where you have openssl.exe.</span></li>
<li><span style="font-family: "Trebuchet MS",sans-serif;">fire command "OpenSSL.exe pkcs12 -export -in cer.cer -inkey key.key -out iis-cert.pfx" where cer.cer is the certificate and key.key is the key file download from sslforfree.com.</span></li>
<li><span style="font-family: "Trebuchet MS",sans-serif;">It will ask you for a password and as it again to confirm. Once you type same password twice, it will generate iis-cert.pfx that you can rename. </span></li>
<li><span style="font-family: "Trebuchet MS",sans-serif;">go to iis server and select the iis server node</span></li>
<li><span style="font-family: "Trebuchet MS",sans-serif;">click on server certificates</span></li>
<li><span style="font-family: "Trebuchet MS",sans-serif;">click on import in the top right section and choose iis-cert.pfx and enter password.</span></li>
<li><span style="font-family: "Trebuchet MS",sans-serif;">This will import ssl certificate in the iis certificate store that you can assign to any site in iis when you choose https binding.</span></li>
</ol>
<h2>
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span></h2>
<span style="font-family: "Trebuchet MS",sans-serif;"> </span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"> </span>Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-23554035422511689652014-11-27T16:32:00.000+05:302014-11-27T16:32:25.809+05:30Integrating servicestack 3 into DNN - Part 1 - Introduction<h2>
Introduction</h2>
In this series of blogs, I will try to share my thoughts of using ServiceStack 3 in DotNetNuke 6, difficulties, limitations and how I finally solve each problem step by step.<br />
<br />
Part 1 - Introduction <br />
<h2>
Background </h2>
I started looking at <a href="https://servicestack.net/" target="_blank">ServiceStack</a> 3 years back when I was working with one of the client who provided <a href="https://servicestack.net/" target="_blank">ServiceStack</a> services and asked me to use them as back end instead of storing data in <a href="http://www.dnnsoftware.com/" target="_blank">DotNetNuke</a> database.<br />
<br />
At the end of project, I learned a lot about servicestack.client and associated facilities and then I invested some time using servicestack to deliver rest base services. Now a days ServiceStack and asp.net web API both are obvious options if you are planning to start any asp.net web services along with WCF. It depends on your experience, your team's experience an vision a lot.<br />
<br />
After learning <a href="https://servicestack.net/" target="_blank">ServiceStack</a>, I utilized it in couple of asp.net based projects which are either conversion of cold fusion to .net services or interoperable database independent service development with .net and I was very happy with the way I achieved best results because of <a href="https://servicestack.net/" target="_blank">ServiceStack</a><br />
<br />
So, some time back, when I started architect a new web platform for one of my recent client, who was using <a href="http://www.dnnsoftware.com/" target="_blank">DotNetNuke</a> and wanted their platform to support APIs so that they can be used with navite mobile apps, I decided to use ServiceStack again in this scenario as well!<br />
<br />
<h2>
Try ServiceStack 3 Hello world!</h2>
<ol>
<li>From Nuget Package Manager Console:<br />
install-package servicestack -version 3 </li>
<li>Since I wanted the base url of the servicestack to start from /api/ instead of / I did some web.config modifications:</li>
<ol>
<li>In handlers section added following line: <br />
<pre><span class="w"> </span><span class="o"><</span><span class="vg">add</span><span class="w"> </span><span class="vg">path</span><span class="o">=</span><span class="s2">"api*"</span><span class="w"> </span><span class="vg">type</span><span class="o">=</span><span class="s2">"ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack"</span><span class="w"> </span><span class="vg">verb</span><span class="o">=</span><span class="s2">"*"</span><span class="w"> </span><span class="o">/></span></pre>
</li>
<li>in modules section added following line:<br />
<pre><span class="w"> </span><span class="o"><</span><span class="vg">add</span><span class="w"> </span><span class="vg">name</span><span class="o">=</span><span class="s2">"ServiceStack.Factory"</span><span class="w"> </span><span class="vg">path</span><span class="o">=</span><span class="s2">"api*"</span><span class="w"> </span><span class="vg">verb</span><span class="o">=</span><span class="s2">"*"</span><span class="w"> </span><span class="vg">type</span><span class="o">=</span><span class="s2">"ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack"</span><span class="w"> </span><span class="vg">resourceType</span><span class="o">=</span><span class="s2">"Unspecified"</span><span class="w"> </span><span class="vg">requireAccess</span><span class="o">=</span><span class="s2">"Script"</span><span class="w"> </span><span class="vg">allowPathInfo</span><span class="o">=</span><span class="s2">"true"</span><span class="w"> </span><span class="vg">preCondition</span><span class="o">=</span><span class="s2">"integratedMode"</span><span class="w"> </span><span class="o">/> </span></pre>
</li>
<li>If you have webdev enabled, do following to support PUT, DELETE verbers ONLY if these verbs are not working in handlers section:<br />
<pre><span class="o"><</span><span class="vg">remove</span><span class="w"> </span><span class="vg">name</span><span class="o">=</span><span class="s2">"WebDAV"</span><span class="w"> </span><span class="o">/></span></pre>
</li>
</ol>
</ol>
Now, servicestack hosting on web requires writing code in global.asax Application_Start event and I was stuck there! I found more than one solution on internet to achieve this, but I decided to modify the code to add another line to initialize servicestack by writing: <span class="pl-s">new</span> AppHost().Init()<br />
<br />
I know change dotnetnuke core dll is not good practice. Suggestions are welcome to fix this in the best possible way! <br />
<br />
In the next part we will start coding a real api!<br />
<br />Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-14296340205122649202014-07-26T13:46:00.004+05:302014-07-26T13:46:57.188+05:30Do you really need role base pages in dotnetnuke?<h3>
Introduction & Background</h3>
I have experience working on an existing dnn site that has lots of custom features and I join the team to contribute as developer, lead or code reviewer. Many times during last 8 years of such experience, I found lots of people are creating role base pages in dotnetnuke and implement some custom login in either login module or somewhere else that can check the role and redirect.<br />
<br />
Is this really required?<br />
<br />
<h3>
Example Scenario</h3>
<div>
Lets say you are working on a hospital portal in dotnetnuke and want to prepare a dashboard for care taker, admin, manager, and bunch of other roles. </div>
<div>
<br /></div>
<div>
If you create different pages and drop a single module for role wise dashboard, and use some custom logic to redirect user after login to that page, that is something that needs a second though.</div>
<div>
<br /></div>
<div>
Dotnetnuke security inherited from portal > Tab > Module. Inheriting up to module level is recommended for most of the cases.</div>
<div>
<br /></div>
<div>
I would create a page(tab) and drop all the modules that I prepared for role wise dashboards. I would do multiple modules to make things separate and clean but drop all modules to the same page. In module settings of each module, uncheck the inherit permission button and check the role which is expected to see this module. </div>
<div>
<br /></div>
<div>
Now, without having too much of coding/customization and tricks, each role can easily access data that is expected to their roles. Easy!</div>
<div>
<br /></div>
<div>
What do you think?</div>
<br />
<br />
<br />Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-30347013350259775462013-01-06T15:27:00.000+05:302013-01-06T15:41:06.975+05:30System.ArgumentException: Exception of type 'System.ArgumentException' was thrown. Parameter name: encodedValue<p>I was configuring one of our clients farm which required FBA on different web applications (around 5) and he wanted each web application should have separate user store. That was too tricky since you just need to set up <em><font face="Courier New">Application </font></em>property of the membership provider and you are done.</p> <p>After completion of these settings, all of my applications were having a common exception either in log out or login to the web application. Here was the exception.</p> <blockquote> <p><font size="2" face="Courier New">System.ArgumentException: Exception of type 'System.ArgumentException' was thrown. Parameter name: encodedValue at Microsoft.SharePoint.Administration.Claims.SPClaimEncodingManager.DecodeClaimFromFormsSuffix(String encodedValue) at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(IClaimsIdentity claimsIdentity, String encodedIdentityClaimSuffix) at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(String encodedIdentityClaimSuffix) at Microsoft.SharePoint.Utilities.SPUtility.GetFullUserKeyFromLoginName(String loginName) at Microsoft.SharePoint.ApplicationRuntime.SPHeaderManager.AddIsapiHeaders(HttpContext context, String encodedUrl, NameValueCollection headers) at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PreRequestExecuteAppHandler(Object oSender, EventArgs ea) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)</font></p></blockquote> <p>After checking all my steps right through starting. After getting all the other exeptions cleared the above exception was the only exception that I was getting. That was resolved using <a href="http://sharepoint.stackexchange.com/questions/23996/exception-of-type-system-argumentexception-was-thrown-got-error-when-i-have" target="_blank">"Exception of type 'System.ArgumentException' was thrown" got error when i have signout from webapplication in sharepoint 2010?</a>.</p> <p>I hope this will help to you if you are getting same error due to a silly custom property of a custom web part for registration!</p> Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com5tag:blogger.com,1999:blog-556731575261585802.post-81105243784067781582012-12-31T09:32:00.000+05:302012-12-31T09:36:02.565+05:30SharePoint 2010 foundation on windows 7<p>If you are planning to install SharePoint 2010 foundation in your windows 7 machine, there are very good references out there in many blogs. But after I installed it I was not able to create new web applications.</p> <p>I noticed, I was an administrator account with different name than administrator. I found <a href="http://www.howtogeek.com/howto/windows-vista/enable-the-hidden-administrator-account-on-windows-vista/" target="_blank">here</a> that we can enable in built administrator account.</p> <p>I enabled administrator account and added it to managed accounts and farm administrators group.</p> <p>After trying so many things from forums, finally I got everything working in SharePoint Foundation in my machine!</p> Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-89784571393743256142012-07-23T20:01:00.001+05:302012-07-23T20:04:18.618+05:30DotNetNuke: As an E-commerce help portal<a href="http://www.dotnetnuke.com/" target="_blank">DotNetNuke</a> is a powerful content management system. I can say this because I am following <a href="http://www.dotnetnuke.com/" target="_blank">DotNetNuke</a> and improving myself since early 4.x release of it. I decided to spend some time on highlighting some of the key projects that I have done during last 6 years, that can describe capabilities of <a href="http://www.dotnetnuke.com/" style="background-color: white;" target="_blank">DotNetNuke</a>. Here is the first one.<br />
<br />
GolfOnline.co.uk - is an online e-commerce portal. An e-commerce portal feel completed once integrated with an easy to use, and great performing CMS. As a solution <a href="http://help.golfonline.co.uk/">Help.GolfOnline.co.uk</a> is built as an answer. This site is built using <a href="http://www.dotnetnuke.com/" target="_blank">DotNetNuke</a> and is working so well.<br />
<br />
Here is the highlight of key features:<br />
<ol><li><b>Authoring</b>: Contents can be hidden to users unless they are approved and intended to show to end users. </li>
<li><b>Branding</b>: Flexible enough to re-use some of the ASCX controls from e-commerce web application for branding purpose. Integration went a little tricky but no problems at all. Most of the css/js/images are used from </li>
<li><b>Performance</b>: Performs like accessing html pages</li>
<li><b>Customization</b>: Build/customize in whatever way you can. Good examples is sub tabs module to - showing child pages are tabs. (jQuery UI, jQuery, DotNetNuke API)</li>
<li><b>CDN</b>: Capability to integrate CDN so that css, js and some static html can be steamed through CDN.</li>
<li><b>SEO</b>: Free of cost implementation of custom urls (Thanks to iFinity Friendly Url Provider), along with all the goodness of SEO. </li>
<li><b>Search</b>: This feature isn't used on site but it can be. In built search engine to find content.</li>
<li><b>Quick</b>: Go live in no time.</li>
</ol><div>Please get some time and visit <a href="http://help.golfonline.co.uk/">help.golfonline.co.uk</a> and feel the strength of <a href="http://www.dotnetnuke.com/" target="_blank">DotNetNuke</a>. Notice the yslow rating and responsiveness of the site. </div><div></div><div>I believe <a href="http://www.dotnetnuke.com/" style="background-color: white;" target="_blank">DotNetNuke</a> can be smartly utilize to provide such kind of solutions in no-time. Isn't it?</div><br />
<br />
<br />Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-40609284359519474802012-02-01T23:00:00.000+05:302012-02-01T23:00:01.771+05:30Database Design : Smartly storing many user settings with Boolean values in a single value - Part 2If you have visited a <a href="http://lakhlaniprashant.blogspot.com/2011/04/database-design-smartly-storing-many.html" target="_blank">previous post</a>, where I have demonstrated how you can use bit masks to reduce your settings table.<br />
<br />
<b>Update:</b><br />
There are situations where this solution will NOT do well. Example are cases where you are having many settings OR expecting more settings in future. After some point, your calculated integer or big integer will become very huge and may cause out of limit. so be careful while deciding to use this solution.<br />
<br />
ALSO, in place of integers, you can use bitbinary datatype with appropriate length and use appropriate bitwise operators in sql server. That will surely gain more performance.<br />
<br />
Thanks to Yougeshwar Patel, Team Lead, Silver touch technologies for bring this to my notice.Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-85530615731426479222012-02-01T22:30:00.000+05:302012-02-03T18:50:34.656+05:30Sharepoint: Creating web application from existing content databaseThere are situations where you want to propagate one SharePoint web application to some other farm/machine. I feel the fastest way is to take content database backup and restore it in your destination farm. I have done so in last couple of weeks and I have leaned how to quickly do that.<br />
<br />
Here are quick notes from my experience:<br />
<b>Pre-requisites:</b><br />
I was provided with content database backup and source code. That makes be able to restore site and generate wsps from source code.<br />
<br />
<b>Creating content database from backup:</b><br />
Go to your database server and do following:<br />
<br />
<ul>
<li>Create a blank database that will be used as content database </li>
<li>Restore a database using content database back up from source farm.</li>
</ul>
<br />
<br />
<b>Creating a web application:</b><br />
<br />
<ul>
<li>Go to sharepoint central administration and create a new web application</li>
<li>While creating a new web application, use existing content database in database section</li>
<li>Sometimes if your database is too large, web application creation takes too long and times out. Don't worry at all. web application is still created successfully. It happened to me 4 times out of 5. </li>
</ul>
<div>
<b>Validating the web application:</b></div>
<div>
<ul>
<li>Go to sharepoint central administration, click on application management. In "Databases" section you will find "Manage content databases"</li>
<li>Choose your application and it will show database status and number of site collections. If you are not sure how many site collections are there in backup, anything greater than 0 is good news.</li>
</ul>
<div>
<b>Configure web application to work properly:</b></div>
</div>
<div>
we are almost done now. Do following:</div>
<div>
<ul>
<li>Go to sharepoint central administration</li>
<li>Click on "Application Management"</li>
<li>In "Site Collections" section click on "Change site collection administrators"</li>
<li>choose your web application set proper data in site admins.</li>
</ul>
<div>
<b>Additional optional steps:</b></div>
</div>
<div>
After performing all the above steps, it is still possible that you are not able to access your web application. </div>
<div>
<ul>
<li>Last thing to do is to install and deploy wsp by using stsadm or your favorite method. </li>
</ul>
<div>
<b>Conclusion:</b></div>
</div>
<div>
It is always challenging to move applications from one farm to another. Specially when they are depending upon other service applications. In spent last two weeks to learn how to properly do that. I hope this will help you at some point during your sharepoint development.</div>
<div>
<br /></div>
<div>
Happy sharepoint administration!</div>
<div>
<br /></div>Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-35978008689609729812012-01-05T22:00:00.000+05:302012-01-05T20:39:27.578+05:30Exeception: admin/Menus/DNNActions OR DotNetNuke.UI.Containers.ActionButtonList.get_ModuleActions throws null reference exception<h3>
Problem:</h3>
If you have deleted or your dotnetnuke installation failed to install DDR Menu module, you will get following.<br />
<br />
<pre>an error has occurred. DotNetNuke.Services.Exceptions.PageLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.UI.Containers.ActionButtonList.get_ModuleActions() at DotNetNuke.UI.Containers.ActionButtonList.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---
</pre>
<br />
OR<br />
<br />
<pre>An error has occurred.DotNetNuke.Services.Exceptions.PageLoadException: Couldn't load menu style 'admin/Menus/DNNActions': System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Web.DDRMenu.DNNCommon.DNNContext.get_ModuleFolder() at DotNetNuke.Web.DDRMenu.DNNCommon.PathResolver.Resolve(String path, RelativeTo[] roots) at DotNetNuke.Web.DDRMenu.MenuBase.Instantiate(String menuStyle) ---> System.ApplicationException: Couldn't load menu style 'admin/Menus/DNNActions': System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Web.DDRMenu.DNNCommon.DNNContext.get_ModuleFolder() at DotNetNuke.Web.DDRMenu.DNNCommon.PathResolver.Resolve(String path, RelativeTo[] roots) at DotNetNuke.Web.DDRMenu.MenuBase.Instantiate(String menuStyle) at DotNetNuke.Web.DDRMenu.MenuBase.Instantiate(String menuStyle) at DotNetNuke.Web.DDRMenu.DDRMenuControl.OnPreRender(EventArgs e) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---
</pre>
<h3>
Solution</h3>
It is a good news if you are installing your new dnn instance, you can download latest installation source from dotnetunke.codeplex.com and that will work just fine.<br />
<br />
If you are already having dnn site running and you uninstalled the <a href="http://dnnddrmenu.codeplex.com/" target="_blank">DDR menu</a> by mistake, or you are upgrading the site or <a href="http://dnnddrmenu.codeplex.com/" target="_blank">DDR menu</a> and that caused this problem, there are some ways to fix this.<br />
<br />
Download and setup local copy of fresh dnn installation and do following:<br />
<br />
<ol style="background-color: rgba(255, 255, 255, 0.917969); color: #222222;">
<li style="margin-left: 15px;"><span style="font-family: inherit;">Open web.config of fresh install, and search ddr in it. Copy the DDR entry from it and paste it to appropriate section of your site's web.config.</span></li>
<li style="margin-left: 15px;"><span style="font-family: inherit;">from fresh install replace /admin/menus and /desktopmodules/ddrmenu folders to your site folder.</span></li>
<li style="margin-left: 15px;"><span style="font-family: inherit;">download <a href="http://dnnddrmenu.codeplex.com/releases/70987/download/264940" style="color: #1155cc;" target="_blank">http://dnnddrmenu.codeplex.<wbr></wbr>com/releases/70987/download/<wbr></wbr>264940</a> and paste it into /install/module folder</span></li>
<li style="margin-left: 15px;"><span style="font-family: inherit;">Browser for yoursite.com<span style="background-color: white;">/<wbr></wbr>Install/install.aspx?mode=<wbr></wbr>InstallResources </span><span style="background-color: white;">and that's it</span></span></li>
</ol>
<div>
<span style="color: #222222;"><span style="font-family: inherit;">In my case, we were trying to upgrade the <a href="http://dnnddrmenu.codeplex.com/" target="_blank">DDR menu</a> and found the broken site that was restored using above steps. </span></span></div>
<br />
For more updates and hints visit <a href="http://www.dotnetnuke.com/Resources/Forums/forumid/197/threadid/440334/scope/posts.aspx" target="_blank">this thread</a> on <a href="http://forums.dotnetnuke.com/" target="_blank">dotnetnuke forums</a><br />
<br />Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com2tag:blogger.com,1999:blog-556731575261585802.post-47608269636938689952012-01-02T20:00:00.000+05:302014-11-27T16:43:59.194+05:30Using dapper .net to log site visitors in sqlite database - Part 1<a href="http://code.google.com/p/dapper-dot-net/" target="_blank">Dapper .net</a> is a simple light weight micro ORM<br />
<br />
I came to this library (in fact a single page) while I was learning posts related to how <a href="http://stackoverflow.com/">StackOverflow.com</a> is built. I also noticed that the library is independent of the database, and is useful if you are using any database.<br />
<br />
I feel it is promising, and I am going to write a very simple site visitor logging component with this. The database I will use will be <a href="http://www.sqlite.org/" target="_blank">Sqlite</a> and will log all the page views into database with the user, user agent and url referrer.<br />
<br />
There will be following two NuGet packages that I will require:<br />
<ol>
<li>Dapper .net</li>
<li>System.Data.Sqlite (I am using x86)</li>
</ol>
<div>
I am going to use Application_AuthenticateRequest in Global.asax to add logging.</div>
<div>
<br /></div>
<div>
All the code will be available at <b>https://trickycoders.svn.codeplex.com/svn/WebsiteLogging</b></div>
Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-70083744469934461752012-01-02T19:37:00.001+05:302012-01-03T13:44:47.614+05:30stsadmin -o deploysolution: access denied error<h4>When</h4>As like 80% of the sharepoing developers, if you are deploying your solutions trough command line.<br />
<br />
<h4>What</h4>After firing deploysolution, looking at system settings > farm solutions and the error looks something like "Can not overrite xxxx file, access is denied".<br />
<br />
<h4>Solution</h4>It was due to my source file was read only. I tried by un-checking the read only attribute from properties for source file and tried the command again. I got the same error couple of times and repeating the same solution fixed the problem. <br />
<br />
<h4>Conclusion</h4>As a social animal, when I get such kind of error first time in my life, I first ask to couple of developers around me if they have seen the same error ever, that helps a lot. When I do same, I got many useful hints that can either quickly solves the problem or useful for some future problems. <br />
<br />
<h4>Update - 3-Jan-2011:</h4>If you are having more than one application server in farm then you have to go through all of them and uncheck read only to get it working.<br />
<br />
Got the same error? Don't worry try above solution and let me know if same OR some other solution worked for you.<br />
<br />
Happy sharepoing deployment!<br />
<br />
<br />
<br />
<br />
<br />
<br />Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-24475690041696233182011-12-29T11:26:00.000+05:302011-12-29T11:26:50.994+05:30GoDaddy - Using host entries to access your site by IP<h3>Problem</h3>
Your site is live right now and you want to transfer it to another account hosted in GoDaddy.com. You have configured the site in new account and want to test it, but you can not directly update the DNS records without testing. You don't want to purchase a static IP for this. So, there should be a way to test your site before updating DNS records.
<h3>Solution</h3>
One of the solution is the use hosts entries. That will help you to access your domain point to the new IP only for you. That way, when other people accesses www.yoursite.com, it will be served from original site, but because of the host entry, when you try to access www.yoursite.com it will be served from the new server.
I found the detailed instruction here: http://help.godaddy.com/article/3354Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-79705420213847839182011-12-23T15:24:00.001+05:302011-12-24T12:36:54.061+05:30Runtime error: ; expected<br />
I was working in asp.net with vb.net for for almost 3 years now, and now after 3 years, just started working on c# as back end language. So many times in a day I miss writing ; and got the this error! <br />
<br />
I recently got this error in ascx control as well, when I was working in a repeater item template and missed # and write Eval like <% Eval...<br />
<br />
Compiling code in C# reminds me to the starting of my career since I have worked on C# first.Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-28848352558833946412011-12-16T15:54:00.000+05:302011-12-17T15:17:27.761+05:30Sharepoint: Debugging - which process to attach<div dir="ltr" style="text-align: left;" trbidi="on">As some of you may already be knowing, I have just joined a team of sharepoint developers and right now learning sharepoint development.<br />
<br />
<br />
<br />
This is my first day to work on a development after watching videos and reading books and I already find myself lost while attaching to the process for debugging a webpart control in sharepoint. Here is how I finally got my ProcessID to attach:<br />
<br />
Just open command prompt as administrator and type following:<br />
<br />
<pre class="csharp">%windir%\system32\inetsrv\appcmd.exe list wp</pre><br />
Hope this will help to the developers who are new OR not knowing the way to find which process to attach.<br />
<br />
Happy coding.</div>Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-66918773205705346482011-04-10T14:33:00.000+05:302011-04-10T14:33:37.882+05:30OSDNNSKINS: New version of cash and multiflex with portal template available<div dir="ltr" style="text-align: left;" trbidi="on">
Hi all,<br />
<br />New Version for <a href="http://www.blogger.com/">Cash</a> and <a href="http://osdnnskins.codeplex.com/">Multiflex</a> is available for download. This time we have three common changes for both of the skin packages.<br />
<ol style="text-align: left;">
<li>There is only single package for skin and container installation</li>
<li>Portal template is available to quickly evaluate the skin. </li>
<li>Both of the skins are tested in dnn 6.0.0.44 </li>
</ol>
For those who are not knowing about this, open source dotnetnuke skins is an initiative to provide high quality free skins to dnn community.<br />
<br />
<b>More contributors to osdnnskins:</b><br />
<br />
We have more contributors to join the party, so we welcome issues and suggestions from community in order to help them provide quality skins for free.<br />
<br />there are lots of evaluations and<b> </b>also there are many sites using skins from osdnnskins, there are very less number of comments and feedback that we get. <b><a href="http://dotnetnukeblogs.com/"></a></b><br />
<b><br /></b><br />
<b>Please please please provide your feedback about any skin that you evaluate and you can directly go to osdnnskins.codeplex.com to create a new issue or you can email me any time for any kind of help regading the same.</b><br />
<b>You can contact email @ lakhlaniprashant [at} gmail [dot} com</b><br />
<b><br /></b></div>Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-51151328868180095042011-04-07T08:03:00.000+05:302011-04-07T08:38:19.767+05:30Database Design : Smartly storing many user settings with Boolean values in a single value<div dir="ltr" style="text-align: left;" trbidi="on">
It is obvious that when we design database tables for storing user preferences we look user settings as one-to-many relationship, but there are cases when all your setting values are boolean. For example, you have many type of newsletters (infoq.com has .net, java, soa etc) and you want to user choices, OR you have many categories of articles and you want to store which categories user is interested to browse, user choose tags (fev tags) are also good example in stackoverflow.com.<br />
<br />
<b>Problem:</b><br />
How to efficiently store user preferences which are all having boolean values.<br />
<br />
<b>Classic solution:</b><br />
<ul>
<li> Create a subscription_type database which stores all the subscription types</li>
<li>Create a user_subscription table user_subscriptions with columns user_id and subscription_id</li>
<li>Insert a new row for each kind of subscription for each user</li>
<li>Delete a row for each kind of subscription user un-check (In case user checks the subscription and un-checks it after some days)</li>
</ul>
This will work fine but the only problem is to maintain an extra table for storing the details.<br />
<br />
<b>Better Solution:</b>
<br />
<ul>
<li>Create a subscription_type table which stores all the subscription types.</li>
<li>add a new column in users table for subscription.</li>
<li>use following query to retried user subscriptions:<br />
<blockquote>
select <br />
user_id, <br />
case when <br />
subscription & power(2,subscription_type_id) =0 <br />
then 0 <br />
else 1 end as is_subscribed,<br />
subscription_type_id,<br />
subscription_type_name<br />
from users cross join subscription_types<br />
where user_id = @user_id</blockquote>
</li>
<li>user following query to store user subscription:<br /><blockquote>
select sum( power(2,subscription_type_id))
from subscription_types where subscription_type_id in (1,2,3)
</blockquote>
</li>
</ul>
here subscription_type_id in (1,2,3) describes the subscription type id user is subscribed to.<br />
<br />
<b>How It Works:</b><br />
We are storing sum of binary power as user preference. For example, user is subscribed to subscription type 0,1, and 3 we are storing power(2,0) + power(2,1) + power(2,3) = 1 + 2 + 8 = 11.
<br />
For reading a boolean value of subscription we are using t-sql’s AND (&) operator. We are doing and operation of 11 and binary power of subscription type, and it we get 0 means user is not subscribed, otherwise we will get power(2,subscription_type) as result of AND operation.
<br />
<br />
<b>Conclusion:</b><br />
We can say the solution is better because you can using single query to read and write the subscription. It is more faster, and requires no additional table. There are many other advantages that you can think of.
<br />
<br />
<b>Limitations:</b><br />
Every time you take this kind of solution, you are killing possibility to store details that depends on the relationships. In our subscription example, you will never get information about when does a user subscribed to which subscription type individually. <br />
If that is not important to you, you can obviously go for it.
<br />
<br />
<b>Note: </b><br />
Please note that in actually situations, subscription table and related designs are really more complicated than what I’ve shown above, so it demonstrates the example scenario and not the example database design for any kind of system.
<br />
Have fun with your database design! </div>Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-53834803243262613672010-12-11T11:52:00.000+05:302010-12-11T12:18:23.918+05:30Using master pages and aspx pages in dnnIn this post, we are going to see how we can add new aspx pages by re-using the existing skin designs to implement some helpfull programming in it.<br />
<span class="Apple-style-span" style="font-size: 19px; font-weight: bold;"><br https:="" p1="" redirect.srv="" saorsbzq="" server1.kproxy.com="" servlet="" snop="" sruj="" https://server1.kproxy.com/servlet/redirect.srv/sruj/saorsbzq/snop/p1/></span><br />
<span class="Apple-style-span" style="font-size: 19px; font-weight: bold;">Why?</span><br />
<span class="Apple-style-span" style="font-size: x-large;"><span class="Apple-style-span" style="font-size: 19px;"><b><br https:="" p1="" redirect.srv="" saorsbzq="" server1.kproxy.com="" servlet="" snop="" sruj="" https://server1.kproxy.com/servlet/redirect.srv/sruj/saorsbzq/snop/p1/></b></span></span><br />
If you are running a multi-portal dnn website and want to build some common pages to share between those portals, there are couple of quick ways to do that.<br />
<br />
<ol>
<li>1. Create a new tab in portal 0 and then share link in all other portals.<br https:="" p1="" redirect.srv="" saorsbzq="" server1.kproxy.com="" servlet="" snop="" sruj="" https://server1.kproxy.com/servlet/redirect.srv/sruj/saorsbzq/snop/p1/> This technique works fine when you want to show "how to" page or help page, static contents or offers related pages. You don't need any custom coding for this and it will be a matter of adding a text html module and paste the html that you designed!</li>
<li>2. Create a new aspx page and share link in all other portals.<br https:="" p1="" redirect.srv="" saorsbzq="" server1.kproxy.com="" servlet="" snop="" sruj="" https://server1.kproxy.com/servlet/redirect.srv/sruj/saorsbzq/snop/p1/> Well, this one also looks similar to first option but let's think about this: If you are running a multi-portal dnn site and want to show latest offers from all the portals into a page based on user's country, and users having at least 5 orders in history. Now, this will involve some quick coding to do. So, basically, if you want to show content based on some dynamic parameters like user or portal data or similar data, it will be good to create an aspx page.</li>
</ol>
There is another option! obviously you can create a new module to do this, but remember that we are not doing anything that depends on moduleId or tabId but depends on UserId or PortalId, so I believe it's a quick way to create a new page in place of building an entire dnn module.
<br />
<span class="Apple-style-span" style="font-size: 19px; font-weight: bold;"><br https:="" p1="" redirect.srv="" saorsbzq="" server1.kproxy.com="" servlet="" snop="" sruj="" https://server1.kproxy.com/servlet/redirect.srv/sruj/saorsbzq/snop/p1/>How?</span><br />
<ol>
<li>1. Create a new theme <br https:="" p1="" redirect.srv="" saorsbzq="" server1.kproxy.com="" servlet="" snop="" sruj="" https://server1.kproxy.com/servlet/redirect.srv/sruj/saorsbzq/snop/p1/> Create a new theme with the name of your skin and paste your skin's css and images into it. </li>
<li>2. Create a new master page<br https:="" p1="" redirect.srv="" saorsbzq="" server1.kproxy.com="" servlet="" snop="" sruj="" https://server1.kproxy.com/servlet/redirect.srv/sruj/saorsbzq/snop/p1/> Create a new master page and paste your skin's ascx control's entire markup over there. Replace all your content pane (i.e. div or tds with runat=server) with CotentPlace holder</li>
<li>3. Create a new page<br https://server1.kproxy.com/servlet/redirect.srv/sruj/saorsbzq/snop/p1/>- Add a new aspx page called Default2.aspx and select the new master page when creating it. <br https://server1.kproxy.com/servlet/redirect.srv/sruj/saorsbzq/snop/p1/>- Go to .aspx.vb file and make your parial page class inherit from DotNetNuke.Framework.PageBase in place of System.Web.UI.Page <br https://server1.kproxy.com/servlet/redirect.srv/sruj/saorsbzq/snop/p1/>- And that's it you are ready to go!</li>
</ol>
<h3>
Conclusion </h3>
It is really easy to add a new aspx page in dnn that is re-using skin and you will be able to access all the information like PortalSettings, UserInfo etc. Things like Tab and Module will not be there and it's obvious! <br />
<blockquote>
This post doesn't say you should create a new aspx page in some cases or not, but demonstrates how to do it if you want. If you have some good examples WHEN we can use it or some good examples WHEN we should NOT use it, I welcome them! </blockquote>
This example will probably work with dnn 4.x and 5.x, though I've used this in dnn 4.5.6 and 5.2.0 etc.
<br />
<h3>
Downloads </h3>
You can <a href="http://trickycoders.codeplex.com/releases/view/57324" id="ssv0" title="download">download</a> the example code for this example from <a href="http://trickycoders.codeplex.com/releases/view/57324" id="l6oy" title="codeplex">codeplex</a> Happy coding with dnnPrashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com2tag:blogger.com,1999:blog-556731575261585802.post-41908902185747439772010-12-04T18:56:00.001+05:302010-12-04T19:04:49.592+05:30DotNetNuke 5.6 - A potentially dangerous Request.Form value was detected from the clientToday morning, when I was preparing for a new installation instance for dnn 5.6, I was facing trouble to install new module, create new tab and I come to the conclusion that any post back event from the site was causing the "potentially dangerous Request.Form value".<br />
<br />
I was still able to install module using /Install/Install.aspx?mode=installresource but finally stuck when I was not able to add the installed module into page.<br />
<br />
Finally, after reading several articles on web, I found web.config's httpRuntime element needs another attribute called : requestValidationMode="2.0"<br />
<br />
I go the solution here (<br />
http://stackoverflow.com/questions/81991/a-potentially-dangerous-request-form-value-was-detected-from-the-client/3368769#3368769).<br />
<br />
And finally, I was on my way to regular work.<br />
<blockquote>please note that I was trying this on having webmatrix installed and I was browsing the site in asp.net 4.0 integrated mode. <br />
</blockquote>Hope this will help to someone in the same kind of trouble.Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com2tag:blogger.com,1999:blog-556731575261585802.post-15214851611851998752010-11-18T13:46:00.000+05:302010-11-18T13:46:00.268+05:30DNN Module development Using Nhibernate<div><b>Introduction</b></div><div>Hi All this is my first blog on <a href="http://lakhlaniprashant.blogspot.com/">Tricky Coders</a>. In my last project which is in <a href="http://asp.net/">asp.net</a> and I have used Nhibernate as the ORM which is very stable and also an open source project like <a href="http://www.dotnetnuke.com/">DotNetNuke</a>. So I decided to used it with DNN.</div><div><b>Prerequisites</b></div>Please download latest verion of <a href="http://nhforge.org/media/">NHibernate</a>.<br />
<div><ol><li>Nhibernate.dll -This contains the NHibernate framework</li>
<li>Iesi.Collections.dll -Iesi.Collections.dllContains the definition of some special collections used by NHibernate</li>
<li>Castle.Core.dll-Base library is needed by Castle.DynamicProxy2.dll</li>
<li>Castle.DynamicProxy2.dll - This contains code to generate proxies and is used by NHibernate to make e.g. lazy load possible</li>
<li>We need to make some modifications in the web.config to support the Nhibernate.</li>
</ol></div><div></div><div><b>Getting Started with Module Development</b></div><div>To create my module in <a href="http://www.dotnetnuke.com/">DotNetNuke </a>using Nhibernate i have used 2 projects</div><div><ol><li>DataAccessLayer- This class library project serves the purpose to connect with database by creating the object of Session Factory.</li>
<li>Mapping Classes- This Class Library project serves the purpose of Defining the Entites and their mapping xml files.</li>
<li>My Actual <a href="http://trickycoders.codeplex.com/releases/view/55873/"> module </a> which refer the above Projects to talk with data base.</li>
</ol><b></b><br />
<b>Download </b> <br />
<ol></ol>You can <a href="http://trickycoders.codeplex.com/releases/view/55873">download</a> this module's source and installation package from tricky coder's <a href="http://trickycoders.codeplex.com/">codeplex project</a><br />
<br />
<br />
Please let me know about your views and suggestions to improve the code.<br />
<br />
Hope this will help.</div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-556731575261585802.post-85054044886559352992010-11-04T17:02:00.000+05:302010-11-04T17:07:29.477+05:30using WSO2 ESB to mediate WCF Service - Part 2<blockquote>In <a href="http://www.blogger.com/">previous post</a>, I demonstrated how to use <i>Pass Through Proxy</i> to mediate a basic WCF Service which is having <i>GetData </i>and <i>GetCustomTypeData </i>methods. In part 2, We will try to add UsernameToken security at <i>WSO2 ESB</i> level. </blockquote><span style="font-size: large;">Pre-Requisites:</span><br />
<ul><li><a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=018a09fd-3a74-43c5-8ec1-8d789091255d&displaylang=en">Microsoft Web service Enhancements 3.0</a> for implementing WS-Security at client end in vb.net console application</li>
</ul><br />
<span style="font-size: large;">Updating Service Implementation:</span><br />
<blockquote><span style="font-size: large;"><span style="font-size: small;">Right now, I don't know how to use mediator to remove security header from soap envelop before sending it to the real service. I tried using Transformation > Header mediator but it didn't worked for me, so I used WCF Service side wrok around here. Please let me know how to do that, if some of you may know?</span> </span></blockquote><ul><li><span style="font-size: small;">Open <span style="font-size: large;"><span style="font-size: small;">Service1.svc.vb and add following attribute to Service1 class</span>:</span></span><span style="font-size: large;"><br />
</span></li>
</ul><pre class="vb" name="code"><servicebehavior(validatemustunderstand:=false)> _
</pre><span style="font-size: large;">Securing wso2 esb service:</span><br />
<ul><li>Login to esb website, and go to Services > List and click on WCFService</li>
<li>Click on Security</li>
<li>Select "Yes" for Enable Security and Select first option "UsernameToken"</li>
<li>Click on next and check the check box "Admin"</li>
<li>You will be redirected to service dashboard. </li>
<li>That's it.</li>
</ul><span style="font-size: large;">Updating client to include security:</span><br />
<ul><li><span style="font-size: small;">Install WSE 3.0 and add reference the wse 3.0 dll from it's installation directory to client project </span></li>
<li><span style="font-size: small;">Open Reference.vb from your client code, and change your web service class inherited from Inherits <i>Microsoft.Web.Services3.WebServicesClientProtocol</i></span></li>
<li><span style="font-size: small;">Rebuild the client project again to make sure we haven't broken anything</span></li>
<li><span style="font-size: small;">Open Module1.vb and add following lines before calling GetData:<br />
<pre class="vb" name="code">Dim client As New localhost.WCFService
Dim U As New UsernameToken( _
"admin", _
"admin", _
PasswordOption.SendPlainText)
client.RequestSoapContext.Security.Tokens.Add(U)
ServicePointManager.CertificatePolicy = New TrustAllCertificatePolicy()</pre></span></li>
</ul><span style="font-size: large;">Conclusion: </span><br />
<blockquote><span style="font-size: large;"><span style="font-size: small;">This way we can use wso2 esb to secure wcf service implemented using basicHttpBinding. Advantages here is, we are using separate GUI base server for securing wcf service which is too easy to maintain. </span> </span></blockquote><blockquote><span style="font-size: large;"><span style="font-size: small;">It is obvious that this example is very basic and it is just an exercise to add security in wcf services implemented using basicHttpBinding. <br />
<br />
Next steps will be to add some real life use cases that makes presence of esb more appropriate and not only for security.<br />
<br />
Pelase provide your thoughts on wso2 esb and wcf integration and if you are having trouble integrating with the same, you can drop me and email or post a comment here. </span></span></blockquote>Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-77657270281816275832010-11-04T11:02:00.000+05:302010-11-04T11:12:34.420+05:30using WSO2 ESB to mediate WCF Service<blockquote>In this post, I'm going to create a new WCFService with <a href="http://msdn.microsoft.com/en-us/library/ms731361.aspx">basicHTTPBinding </a>and deploy it to IIS. I will mediate the deployed service with <a href="http://www.wso2.org/downloads/esb">WSO2 ESB 3.0.0</a>. For mediating the service, I will use "Pass Through Proxy". </blockquote><div class="separator" style="clear: both; text-align: center;"></div><ol><li>Pre-requisites</li>
<ol><li>Visual Studio 2008 or higher to create WCF Service</li>
<li>wso2 esb 3.0.0 or higher, <a href="http://wso2.org/downloads/esb">get it from here</a></li>
</ol><li>Install and Start <a href="http://www.blogger.com/"> </a><a href="http://www.wso2.org/downloads/esb">WSO2 ESB 3.0.0</a></li>
<ol><li>Extract the downloaded esb files</li>
<li>Go to command prompt</li>
<li>locate to bin directory of extracted esb</li>
<li>write "wso2server.bat" and that will start the wso2 esb server after a few seconds</li>
</ol><li>Create a new WCF Service</li>
<div class="separator" style="clear: both; text-align: center;"></div><ol><li>Start Visual Studio and go to File > New Project<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjThVwi8R2V1MRnhbZ1rO1_dZOZk1jTAQgh2cFnPEBrBMhrFmTu5B6A9UxOtNEQ70jremdGWL96aWncb_nzhXlT1uCxCk6g5xZhLBV24GWX9LvkZZHZmxBEdhXwAhuCAR9FAv5uNsvpROY/s1600/create_wcf_service.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjThVwi8R2V1MRnhbZ1rO1_dZOZk1jTAQgh2cFnPEBrBMhrFmTu5B6A9UxOtNEQ70jremdGWL96aWncb_nzhXlT1uCxCk6g5xZhLBV24GWX9LvkZZHZmxBEdhXwAhuCAR9FAv5uNsvpROY/s1600/create_wcf_service.PNG" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Create a new WCF Service Application from visual studio</td></tr>
</tbody></table><div class="separator" style="clear: both; text-align: center;"></div></li>
<li>That will create a new WCF Service</li>
<li>Open web.config and go to "system.serviceModel" element:<br />
<br />
<pre class="xml" name="code"><service name="xxx" behaviorConfiguration="xxxx">
<!-- Service Endpoints -->
<endpoint address="" binding="basicHttpBinding" contract="xxxx">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</pre><br />
Make sure you change the endpoint element's binding attribute is having value basicHttpBinding<br />
</li>
<li>Just Right click on the service project and click on Build Project</li>
<li>It show you "Build Success" in status bar</li>
<li>Right click on project again and click on publish</li>
<li>Create a new folder called WCFServiceDeployed and select it as output directory</li>
<li>Go to IIS and Create a new virual directory called "WCFService" and point it to WCFServiceDeployed folder</li>
<li>right click on Service1.svc (or whatever svc file you have) and click on browse.</li>
<li>Copy the wsdl url shown in the service page.</li>
</ol><li>Create Pass through proxy in wso2 esb </li>
<ol><li>Make sure you have wso2 esb up and running</li>
<li>Locate your browser to https://localhost:9443/carbon</li>
<li>use admin/admin as username/password to login to the site</li>
<li>Click on Services > Add > Proxy Services</li>
<li>Click on "Pass Through Service"</li>
<li>enter "WCFService" in "Proxy Service Name" text box</li>
<li>In "Target Url" add url of WCF Service</li>
<li> Expand "Publish WSDL" option</li>
<li>From the Publish WSDL drop down menu, choose "Specify Source Url"</li>
<li>In the text box of WSDL URI, enter your published svc url suffixed with ?wsdl</li>
<li> Expand Transport</li>
<li>Uncheck HTTPS transport </li>
<li>Click on create</li>
<li>Go to Services > List</li>
<li>Click on WCFService</li>
<li>Copy the endpoint url</li>
</ol><li> Creating Client for the newly created service in esb</li>
<ol><li>Start Visual studio</li>
<li>Create a new console application project (i'm using visual basic)</li>
<li>Right click on the project and click on add web reference</li>
<li>enter the url of the endpoint that you get from web esb</li>
<li>click on ok</li>
<li>go to module1.vb</li>
<li>Add following code:<br />
<pre class="vb" name="code">Dim client As New localhost.WCFService
Dim strData As String = client.GetData(100, True)
Console.WriteLine(strData)
Dim cmpType As New localhost.CompositeType
cmpType.BoolValue = True
cmpType.BoolValueSpecified = True
cmpType.StringValue = "It works" </pre><pre class="vb" name="code">Dim retCmpType As localhost.CompositeType = client.GetDataUsingDataContract(cmpType) </pre><pre class="vb" name="code">Console.WriteLine(retCmpType.StringValue)
Console.ReadKey()
</pre></li>
</ol></ol>That's It, you will see the output in console window. Press any key to exit the console application.<br />
<blockquote>Please note that I'm using web reference because I am not able to correcly implement WCF Client for the service yet. In upcoming post, I will cover how to secure WCF service with basicHTTPBinding with wso2esb</blockquote>Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com2tag:blogger.com,1999:blog-556731575261585802.post-65264871293622095352010-11-02T17:19:00.000+05:302010-11-02T17:22:14.532+05:30Building Java Web Services with Axis2 and EclipseI was working on middle-ware integration with <a href="http://www.wso2.org/">wso2</a> and <a href="http://ws.apache.org/axis2/">axis2</a> web services since last couple of months. In this post, I will show how to get started with axis2 development and deployment using <a href="http://www.eclipse.org/">Eclipse IDE</a>.<br />
<ol class="ol"><li>If you are not having an <a href="http://www.eclipse.org/">Eclipse IDE</a>, I am using <a href="http://download.eclipse.org/webtools/repository/helios/">helios</a></li>
<li>If you are already having <a href="http://www.eclipse.org/">Eclipse IDE</a>. make sure you have <a href="http://www.eclipse.org/webtools/">WTP Plugin</a> installed.</li>
<li><a href="http://www.vogella.de/articles/Eclipse/article.html#start">Create a new workspace in eclipse</a> </li>
<li>Download and install any version of <a href="http://tomcat.apache.org/">apache tomcat</a> (I'm using <a href="http://tomcat.apache.org/download-55.cgi#5.5.31">tomcat 5.5</a>). If you are having troubles configuring it on your machine, you can locate to apache tomcat help for installation <a href="http://tomcat.apache.org/tomcat-5.5-doc/setup.html">here</a></li>
<li><a href="http://www.eclipse.org/webtools/jst/components/ws/1.0/tutorials/InstallTomcat/InstallTomcat.html">Add apache tomcat</a> server to your <a href="http://www.eclipse.org/">Eclipse IDE</a>, and <a href="http://www.eclipse.org/webtools/jst/components/ws/1.0/tutorials/InstallTomcat/InstallTomcat.html">here is how you can do it</a>.</li>
<li>Get Axis2<br />
Download latest source of Axis2 from <a href="http://ws.apache.org/axis2/">here</a></li>
<li>See Anil John's <a href="http://www.aniltj.com/blog/2006/02/06/InstallAndConfigureApacheTomcatAxisForWebServiceDevelopmentOnWindowsXPSP2.aspx">this article</a> for properly configuring axis2 and related environment variables.</li>
<li>Once you are done with step 7, you can start integrating axis2 with Eclipse IDE by using <a href="http://www.eclipse.org/webtools/community/tutorials/BottomUpAxis2WebService/bu_tutorial.html">this article</a> at <a href="http://www.eclipse.org/webtools/community/tutorials/">eclipse WTP Tutorials.</a></li>
<li>For deploying axis2 plugin using .aar package, donwload <a href="http://ws.apache.org/axis2/tools/1_4/eclipse/servicearchiver-plugin.html">Apache Axis2 Archive plugin</a></li>
<li>Extract the zip file of <a href="http://ws.apache.org/axis2/tools/1_4/eclipse/servicearchiver-plugin.html">Apache Axis2 Archive plugin</a> and copy the folder having plugin.xml and paste it to plugins folder of your eclipse installation root directory</li>
<li>You are done with the configuration and ready to create a new web service. <a href="http://www.eclipse.org/webtools/community/tutorials/TopDownAxis2WebService/td_tutorial.html">See this tutorial</a> on eclipse WTP tutorials to create a new axis2 service.</li>
</ol><blockquote>I am a .net developer, and successfully created and deployed the services created using <a href="http://www.eclipse.org/">Eclipse IDE</a> to <a href="http://wso2.com/products/web-services-application-server/">wso2 wsas</a>.I have done this using windows xp, apache tomcat 5.5, axis2 1.5 and wso2 wsas 3.0.0. I hope this post will be helpful to you and will save your time to get started with axis2 development. </blockquote>I will try to share my experience of working with <a href="http://wso2.com/products/web-services-application-server/">wso2 wsas</a> and <a href="http://wso2.com/products/enterprise-service-bus">wso2 esb</a> with you in upcoming posts.Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0tag:blogger.com,1999:blog-556731575261585802.post-22208883003513969062010-11-01T21:23:00.000+05:302010-11-01T21:23:06.645+05:30Unable to engage module rampartIf you have ever tried to create an axis web service with security, you probably have see this error:<br />
<blockquote>AxisFault: unable to engage module "rampart" </blockquote>When I encountered this problem, I was working with eclipse having axis2 plug-ins. I found a solution in <a href="http://wso2.org/forum/thread/5555" rel="nofollow,noindex">WSAS Forum</a>.<br />
<br />
Wonderful thing to note is, I got this error fixed and while reading the forums of wso2 wsas, I got this link and I thought it would be good to share this.<br />
<br />
<blockquote>Note: This post is applicable to those who are not using axis2 repositories for development and using standalone eclipse projects. I was using the same.</blockquote>Prashant Lakhlanihttp://www.blogger.com/profile/16758796316387065127noreply@blogger.com0