Register ASP.Net 4.5 on IIS 10.0

Brief background of the issue –  I was trying to deploy my ASP.Net application on IIS 10 on my Windows 10 machine. The application was originally built in Visual Studio 2010 with framework 3.5.

I never faced issues while hosting it on lower versions of IIS.

But recently I got this new machine which has windows 10 and comes with IIS 10.0 as default. While installing studio, I decided to go with the latest version, i.e. 2015.

This is when the trouble started! The IIS didnt seem to understand the ASP.Net application and gave abstract errors. Searching on Google didnt help much.


Many of the links asked me to reinstall IIS, few asked me to update Applicationhost file, few asked me to check the folder permissions etc. But nothing seemed to help.

Finally, in one of the links I got to know that our usual “aspnet_regiis“does not work for framework 4.5.

On searching further, I got resolution to my issue on stackoverflow

Below are the steps –

  1. Open the Developer Command Prompt for VS2015 as Administrator
  2. Run dism /online /enable-feature /all /featurename:IIS-ASPNET45
  3. It will enable feature to register ASP.Net with IIS


Thats it! This worked for me. Hope it works for you as well.

Happy coding!

Show or Hide Ribbon control based on Group Permission

In one of our releases, we came across a requirement to show or hide one of our custom button on ribbon control, based on the groups in which the logged in user is added.

To know, how to add a button on Ribbon control, refer – Adding a button on Ribbon

1. Add a class which will have code for the hiding the button. Lets say, we named the class as “ButtonShowHideDelegate

1. Add a delegate control to the solution from the installed templates as shown below-

Delegate option in Sharepoint Installed templates

Delegate option in Sharepoint Installed templates

2. A settings page will popup for configuring the Delegate Control as shown below –

DelegateControlSettingsClick on the Next button, and then Finish.

3. Open  the “Elements.xml” file and set the value for various properties as shown below –

elements.xmlDescription of above properties,

  • “Id” is the control of MasterPage  which we are replacing using our delegate control.
  • “Sequence” is the sequence set for control, set the value to any value below 100
  • “ControlAssembly” is the full name of the assembly along with the version and PublicKeyToken. You can get the PublicKeyToken from the assembly.
  • “ControlClass” is the class which will host the code to hide button

4. Below is the code to show/hide button on ribbon control based on the users permission

DelegateOnLoadDescription of the above code –

  • OnLoad” event – We have placed our code in this event so as to execute it while page is loading
  • The first “If” condition checks if the current URL is for the list for which we intend to apply the Show/Hide logic.
  • We take the collection of groups for which the current logged in user is a part of.
  • The LINQ statement checks if “sftp Owners” is one out of many groups of the users.
  • If user is not part of “sftp Owners” group, the custom button on ribbon is hidden for the user.

The above step takes care of the coding part of this requirement.

5. The only thing remaining now is adding this .dll to the SafeControls listSafeControlEntryAdd the “dll” to the SafeControl list as shown above. Please note the Safe Controls flag is set to Yes in the above screenshot.

After all the above steps, your delegate control is ready for deployment.



Adding a button on Ribbon Control of SharePoint site

In this post we shall go through code to add a button on the Sharepoint Ribbon Control. As many of you are aware, Microsoft has introduced ribbon control in Sharepoint 2010. Having introduced it, Microsoft also allows user to customize the ribbon control with activities like adding a button, a group, a tab etc.

So below is the code to add a button on ribbon control through code.

1.Event Receiver Code

Create a Sharepoint Feature and write the below code in the FeatureActivated event of Event Receive.


elevatedWeb.AllowUnsafeUpdates = true;
SPList list = elevatedWeb.Lists[“CustDocLib“];

//Creating Object for User CustomAction
SPUserCustomAction userCustomAction = list.UserCustomActions.Add();
userCustomAction.Title = “Execute Upload“;
userCustomAction.Name = “ExecuteUpload“;
userCustomAction.Location = “CommandUI.Ribbon“;
userCustomAction.CommandUIExtension = @”<CommandUIExtension><CommandUIDefinitions>
<CommandUIDefinition Location=’Ribbon.Documents.Manage.Controls._children’>
<Button Id=’Ribbon.Documents.Manage.Upload’ Sequence=’101′ TemplateAlias=’o1′
Command=’Ribbon.Documents.Manage.CustUpload.cmdCustUpload’ LabelText=’Cust Upload’ />
CommandAction=‘javascript:CustomCommandAction();’ />
userCustomAction.Sequence = 1001;

SPUserCustomAction scriptlink = elevatedSite.UserCustomActions.Add();
scriptlink.Location = “ScriptLink“;
scriptlink.ScriptSrc = “/_layouts/RibbonButton/CustUploadRibbonButtonScript.js“;


2. Java Script

As you can see above, it is calling a javascript method “enableCustUploadApproveButton()” to enable the newly added button.

You need to add a mapped folder for Layouts, and add a JScript file to accommodate your script.

The below script has functionality to enable button on selection of document


  function enableSFTPUploadApproveButton() {
var context = SP.ClientContext.get_current();
return SP.ListOperation.Selection.getSelectedItems(context).length >= 1;


The below script is called on click of the button which  we have added. You can customize it based on your requirements. In my case, I am opening an application page on click of button.


function CustomCommandAction() {

this.currentSiteUrl = ‘http://abcde:2222/sites/testSite&#8217;;
var context = SP.ClientContext.get_current(); // get client context
var web = context.get_web();
var selectedItems = SP.ListOperation.Selection.getSelectedItems(); // Get selected List items
var selectedListId = SP.ListOperation.Selection.getSelectedList();
if (CountDictionary(selectedItems) == 1 && web != null) {
var selectedList = context.get_web().get_lists().getById(selectedListId);
var listItm = selectedItems[0]; // this will only return ID of list item, to get list object server call has to be mad
this.listItem = selectedList.getItemById(;
context.load(this.listItem); // Load listitem in spcontext to fetch all properties of listitem
context.load(context.get_site()); // To fetch site properties

var options = SP.UI.$create_DialogOptions();
var appUrl;
appUrl = this.currentSiteUrl + “/_layouts/RibbonButton/UploadFile.aspx?title=” +

options.url = appUrl;
options.height = 600;
options.width = 800;
options.dialogReturnValueCallback = Function.createDelegate(null, DialogClosedCallback);
SP.UI.ModalDialog.showModalDialog(options); // To Open Page in Model Dialogue

context.executeQueryAsync(Function.createDelegate(this, onQuerySucceeded),
Function.createDelegate(this, onQueryFailed));


Rajgad – King of Forts

Rajgad – literally means King of Forts! I have been craving to visit this place for years, but somehow was not able to make it. This fort is said to be and is actually a must visit for any trekker! It is huge and majestic. Historically, it is arguably the most important fort with respect to Shivaji maharaj’s fight for Swarajya. Even more important than Raigad.

This slideshow requires JavaScript.

About the Fort
Rajgad, most aptly described as the King of forts. At 1395 metres it literally gives an eagle’s view of the surrounding region. It has three machi’s called Sanjeevani, Suvela and Padmavati. The Bale Killa (Bastion) of this fort is well known for it’s peculiar characteristics. There are many routes to climb this fort. One route can take you from Torna to Rajgad.

The two forts are facing each other and are enjoined by a range of hills. It can be a tiring trek of 8 to 9 hours. The royal route or the Raj rasta comes all the way up from Pali village and takes you through the Pali Darwaja which is located on the northern side. It had broad stone cut steps and is an easy access up the fort.

Presently the most used pathway goes from Gunjavne village and instead of taking us to Gunjavane Darwaja, forks to the right and takes us to Chor Darwaja on Padmavati Machi. Gunjavne Darwaja on the south-east side is not much in use due to thick vegetation surrounding it.

The Day Begins

Rajgad is almost 250 kms from Vasai so it was going to take us any where between 5 to 6 hours of traveling from Vasai to Rajgad Base village. We didn’t had the luxury to push the schedule to the second day. Hence we decided to start at 3:00 in the morning, to give us some extra time. We started accordingly at around 3:00 AM and managed to reach Gunjavne village at around 8:30 AM after spending almost 40 mins for searching this place. After a small snack break, we started our trek at around 9:00.

Padmavati Temple

Padmavati Temple

It was raining very heavily,  and the view of the surrounding area especially the valley was getting better and better. The trail from Gunjavne was leading us to Padmavati machi. The peak was covered under fog and hence was not visible until we reached close to it. The path until Padmavati machi is not very difficult with few rock patches in between. The authorities have built iron railings at places wherever it is a bit risky. It took us a couple of hours to reach Padmavati Machi.

On Reaching the Summit

Trail leading to Padmavati Machi

Trail leading to Padmavati Machi

On the summit we can visit four major parts of the fort – the three machi’s and the bale killa. Padmavati machi is broader than the other two, Suvela and Sanjeevani. The ruins of Rajwada, Gunjavne Darwaja, a few temples, Queen Saibai’s tomb and Sadar could be found on this machi . They are fading reminders of the forts glory.

Padmavati temple is in a fairly good state today due to renovation done recently. As one moves away from Padmavati machi with the bale killa on the right there is a small Bhagirathi temple on the other side.

As we move from Padmavati machi keeping the bale killa to our left, we approach Sanjeevani machi.  This machi is enjoined with Budhala machi on Torna by a range of hills between the two huge forts. Since we were running short of time, we skipped the Sanjeevani and Suvela machi and moved directly towards the Bale Killa.

Bale Killa is the crown of Rajgad. It has a unique triangular structure and a single point access. The tricky section is a vertical climb of around 20-25 feet with small holds in the cliff. It is a road to heaven on the slightest mistake. The authorities have tried to build some railings, but the trail remains risky. But the risk is worth the view on top. After climbing the difficult section, we reach the Maha Darwaja. After killing Afzal Khan, his head was sent to Rajgad and was buried near this door following all religious processes. There are a couple of temples, and a small crescent shaped lake called Chandratale on the bale killa. It offers an enchanting view of Padmavati, Sanjeevani and Suvela machi.

For almost 25 years this fort was Shivaji Maharaj’s capital. Rajgad boasts of the highest number of days stayed by Chhatrapati Shivaji Maharaj on any fort. The fort has witnessed lots of historic events, including the birth of Shivaji’s son Rajaram, the death of Shivaji’s Queen Saibai, the return of Shivaji from Agra, the burial of Afzal Khan’s head in the Mahadarwaja walls of Ballekilla.

Mahadarwaza, rajgad

Maha Darwaza

This fort was also one of the 12 forts that Shivaji kept when he signed the Treaty of Purandar (1665) with the Rajput king Jai Singh in 1665 who was leading the Mughal forces. 22 other forts were handed over to the Mughals under this treaty.

We spent some time on the pinnacle and then started descending towards Padmavati machi. We lost our way down to Gunjavne, but fortunately an elderly village lady guided us back till the base village. We had some rest and began our journey back home. We started our journey back at around 3:00 in the afternoon. Taking our morning time as a yardstick we had informed our homes that we’ll reach by 9:00. But whatever energy we had in us was further used up in huge traffic which we encountered first near Pune and later again near Thane. Finally we ended up reaching home at 1:30 in the night. It was a long day for us, more than 22 hours. But yes, we had successfully accomplished one of the most challenging treks in our lives. This feeling of accomplishment far surpasses the exhaustion. The King of Forts is any time worth the pain! Continue reading

Spare a Thought – Part II

Sanmitra Association, Borivli had organised a free medical camp, for Shri Pandurang Narayan Kore Marathi Madhyamik Vidyalaya, Urse – an ashram school near Dahanu on 1st Dec 2013. My wife Dr.Sangeeta Lotlikar, had volunteered with this trust since its earlier camps. I requested the trust members to allow me to take part in the team for this camp.

About Sanmitra Association

Students of the 1975 old SSC Batch of Gokhale Education Society, Borivali High school have formed and registered an association Namely, Sanmitra Association, Borivali, a Charitable trust formed for amongst other objectives to help the children who because of paucity of funds are unable to continue their basic education or people who are unable to continue their treatment for serious disease because of paucity of funds.


Dr.Sangeeta, while checking one of the student

Unlike our earlier camp near Pen (Spare a Thought), this one was quiet well organized. Sanmitra association members had already contacted the school. They already had ample of information regarding the school, the number of students and their specific needs.

The Camp

The High School which we had visited, was run by a trust for poor children, free of cost.  There were around 150 boys and 25 girls, almost all the boys had come from far off places like Jawhar, Wada and VikramGad etc. The trust provides the students with free accommodation facility, food, clothing and books. But it finds it difficult to meet expenses for such a large number of children. The Head Master told us that children usually get two meals per day i.e. one in the morning at 10:00 and the other at 6:00 in the evening. But there are few days when the trust cannot even afford these two meals and the children have to sleep with their stomachs empty. Despite so many challenges the school has managed to maintain a passing percentage of 70% in 10th Std. The 2013 topper from the school was a girl with 76% in SSC. With the resources they have, achieving such kind of result is a remarkable feet.


Dr.Mhatre, advising girls based on their examination

Sanmitra has been associated with the school for quite some time. Prior to the camp, they had provided other means to school like cupboards and tables etc. Since the school is in rural area where primary health checkup facility is scarcely available, this time Sanmitra had decided to hold a medical camp for them. The camp was to be held in the school itself. Apart from my wife, Sanmitra had requested two more physicians and an eye specialist for the camp. As part of the camp, each students weight, height, eye sight was noted and they were thoroughly checked for any medical discrepancy. It was observed that a very high percentage of the students were underweight, and many of them were suffering from basic skin diseases occurring mostly due to bad hygienic condition.

Dr.Sangeeta, while checking one of the student

Sanmitra members guiding the students for maintaining hygiene in the surrounding

The students were given tonics and other necessary medications wherever required. They were later advised how they can maintain good hygiene in their surrounding even with the minimum resources they have. Since the school had sufficient water due to a nearby stream, they were told to wash their bed sheets and cloths more frequently etc.

Well, the camp was conducted very well. It gave us immense satisfaction. In  a sense, we had contributed our bit for the betterment of our society. As for Sanmitra, They are doing a wonderful job for young children in search of knowledge. As Swami Vivekananda once said –

Next to spiritual help comes intellectual help. The gift of knowledge is a far higher gift than that of food and clothes; it is even higher than giving life to a man, because the real life of man consists of knowledge.

Trek to Mahuli

Failed on First Attempt

It was 16th Jan 2010, when we (Team NDS) had planned a Trek to Mahuli. It is not that we were trekking for the first time or we had only trekked to smaller forts. Our team had good experience in trekking, but somehow many small unwanted things happened and finally we fell short of reaching our target. We had to retreat after completing almost 90% of our trek. First of all, our train which was supposed to reach Asangoan around 8:00 reached almost an hour late. By the time we reached the foothills it was almost 10:00. After starting the trek, for the first couple of hours we were lost in the jungle (since not many trekkers trek over here in this season, you hardly find anybody to ask directions), going in a completely incorrect  direction. So the actual trek started only after noon, which is quite late given that it is reasonably hot at noon in January. To add to our problems, we were running out of water and had exhausted almost all of it before getting on the correct path. Thanks to the teams commitment, we attempted to reach the top even after such shaky start. But just commitment was never going to be enough. We couldn’t complete it. Slow and steady we almost reached the top. The final bastion was within our sight. But we couldn’t complete it.😦

The Second Coming

This slideshow requires JavaScript.

Planning for Trek

Coming back to present, as the monsoon had set in on time, all the trekking enthusiast of our office (Team Mphasis) started discussing about possible places for trek. Krishna, my friend, who is leaving our organization in a month, took the initiative and coordinated amongst the team members. After a lot of deliberation we decided to go to Mahuli on 7th July. Since we had sizable number of people who were coming for the trek, we decided to hire a small bus. Every team member was also asked to carry a food item and ample of water.

At The Crack of Dawn
On our way to Mahuli

On our way to Mahuli

The bus was scheduled to leave from Borivli at 6:00. Gagan, Shraddha and Me boarded 5:26 local train from Vasai. Apart from us,  Abhijit, Chetan, Bhavik, Rama and Bhakti too had come to Borivli. Everyone came on time, except the Bus itself.😉 So after waiting for around half an hour we finally left Borivli and picked others (Rupali, Adarsh, Rushabh, Krishna, Ishita, Neha, Lovjit, Lavanya & Krishna M respectively) on our way.  Santosh was the last one (Eighteenth) to board the bus at Thane. Time was passing but we were having fun in the bus, playing antakshari, having Idli and dosas. Every now and then Rushabh use to come up with his own versions of hindi songs. Followed by Bhavik , with his witty jokes. In an hour we had reached the foothills of the fort.

The Trek Begins

The trek begin at around 9:30. Unlike my previous attempt, when there was hardly any group in that season, this time the crowd was in good numbers. Hence there was no scope of getting lost. Apart from the crowd, there was proper arrow markings at regular intervals for people to follow. At the base itself we were required to cross a stream to proceed further. The climate was pleasant, with dense green forest all around. It was not raining though.  The initial climb was very gentle, but as we went higher it became steeper. Since many amongst us were trekking for the first time and Mahuli being the highest peak in Thane district, Expecting everybody to reach the top would have been quite ambitious. Even then, everybody were climbing with reasonable ease. In around an hour, we had our casualty. Gagan, one of our first timer was fully exhausted. After waiting for a while, he asked us to proceed. Neha who has reasonable experience in trekking, was also not feeling well today. But even after that she managed to complete almost half the trek before giving up. Gagan too, tried his level best to continue, but he was too tired to do so. Ishita had some initial hiccups, but she is not one would give up so easily. She took some rest and in few minutes was back with the team.

Yogesh Lotlikar

Its me! On the way to the fort!

Meanwhile, rest of the team continued without any issues. Abhijt was leading the team. Bhavik was helping Rupali to climb. Notably, Rupali and Bhakti, both first timers, were doing exceptionally well.  Looking at them, no one would have said they were trekking for the first time. Infact Rupali was climbing few of the rock patches with utmost ease. Me and Rushabh were at the end for most part of the trek, helping Lavanya over the difficult patches.

Everything was going on smoothly when suddenly Chetan received a call from Gagan. He was saying there was a snake in front of him. According to him, the snake was not allowing him to make any movement. To add to the problem another snake had come to the scene. Everyone went into a tizzy. Poor Gagan was standing alone in that part of the jungle having two snakes staring at him. We had come a long way from where we had left him. So reaching back to him quickly was not a possibility. Anyways, we were contemplating going back to where he was. Just then he called us back to inform us that he is fine. Luckily two other trekkers were returning back and they helped him out. He went back to base village along with them. Phew! What a sigh of relief!! I have been trekking for so many years now. But such an incident have never ever happened to us. At times we have seen snakes, but they never bother us. This was something unusual. But then, it did happen!

Team Mphasis, After reaching the top of the fort

Team Mphasis, After reaching the top of the fort

By this time, we had almost reached the spot where I had stopped on my first attempt. Lavanya was very tired, she would have stopped there itself if any other team member had agreed to stop with her.;) But, fortunately everyone was excited to reach the top and there was no question of going back from there. Also, Gagan’s incident was fresh in her mind, so stopping alone was also not an option for her. We assured her, we were almost there and won’t take much time to reach the top. But to be honest, the last part of the trek was the most difficult. It was steep and rocky. To top it all, it had started raining heavily by then. But we were determined to make it to the top, and yes, we did it!! All of us had reached the pinnacle by 1:00. It was quite pleasant up there. Mild drizzle accompanied with thick fog, with visibility hardly few meters at times. We had some snacks which we had carried and started our descend in some time.

About Mahuli

The peak of this fort is the highest point in Thane district of Maharashtra. The origin of this fort is not known. The forest around this fort is declared as a protected sanctuary. The view from the top is amazing. Due to heavy fog the adjoining pinnacles were not visible though.

When Shahaji Raje became the secretary of Nijamshahi, Adilshahi and Mughals of Delhi together tried to end Nijamshahi. In the year 1635-36, in difficult circumstances Shahaji Raje transferred himself with Jijabai and Shivaji to Mahuli. Khan Jaman, son of Mahabat Khan beleaguered this fort. Shahaji Raje asked for help to Portuguese. They refused and Shahaji Raje surrendered himself.

Shivaji Raje took this fort from Mughals on 8 Jan 1658. In treaty of Purandar, in 1665, Marathas lost these forts again. On 16 June 1670, after two months, Moropant Pingle conquered the forts and Mahuli, Bhandargad and Palasgad became part of Swarajya.

The Descend
Rushabh & Bhavik, relaxing in river water

Rushabh & Bhavik, relaxing in river water

Usually it takes less than half the time it takes to climb any fort. But at Mahuli it was not that easy. The ladder at the top allowed just 2 people to either climb or descend at a time, thus creating a kind of bottleneck. It was raining erratically, making things a bit difficult for us. The trail had become quite slippery. But apart from 2-3 incidents of slipping and falling down, no one else was hurt. Before getting back to the bus, we had some fun in the stream. After all the physical exertion we had been through since morning,this was a welcome break for us. Anyways, this is how we completed our trek. For me, it was a kind of personal score which had to be settled.