Monday, August 25, 2014

How to restrict the '/_layouts/viewlsts.aspx' page from anonymous users or from specified users in SharePoint 2010

Add below specified location section in web.config at path:

 

C:\inetpub\wwwroot\wss\VirtualDirectories\1234\web.config

 

<location path="_layouts/viewlsts.aspx">

            <system.web>

                  <authorization>

                       <allow users="domainname\user1,domainname\user2"/>

                        <deny users="?" />

                        <deny users="*" />

                  </authorization>

            </system.web>

      </location>

 

 

 

 

if you want to apply settings on all web application/site collection then :

 

Create an xml file  as below:

 

<?xml version="1.0" encoding="utf-8" ?>

<actions>

 

  <add path="configuration">

    <location path="_layouts">

      <system.web>

        <authorization>

          <deny users="?" />

        </authorization>

      </system.web>

    </location>

 

    <location path="_vti_bin">

      <system.web>

        <authorization>

          <deny users="?" />

        </authorization>

      </system.web>

    </location>

 

    <location path="_layouts/login.aspx">

      <system.web>

        <authorization>

          <allow users="?" />

        </authorization>

      </system.web>

    </location>

 

    <location path="_layouts/error.aspx">

      <system.web>

        <authorization>

          <allow users="?" />

        </authorization>

      </system.web>

    </location>

 

    <location path="_layouts/accessdenied.aspx">

      <system.web>

        <authorization>

          <allow users="?" />

        </authorization>

      </system.web>

    </location>

 

 

  </add>

</actions>

 

 

After creating a file that contains XML statements similar to above, you would save the file in the \Config directory with a name in the format webconfig. <name>.xml. To apply these changes to the farm, run the Stsadm copyappobincontent operation on each front-end Web server. For more information, see Copyappbincontent: Stsadm operation (Office SharePoint Server).

 

 

Reference Links:

http://technet.microsoft.com/en-us/library/ee191479(v=office.12).aspx

http://msdn.microsoft.com/en-us/library/acsd09b0(v=vs.71).aspx

http://msdn.microsoft.com/en-us/library/8aeskccd(v=vs.71).aspx

Locking down Office SharePoint Server sites

http://www.c-sharpcorner.com/uploadfile/Roji.Joy/how-to-secure-external-anonymous-access-to-sharepoint-2010-sites/

 

Sunday, August 24, 2014

Having problem in debugging javascript/jscript/jquery ? (deb.js)

We all make mistakes. The way we fix them, though, makes all of the difference. Having problem in debugging javascript/jscript/jquery,  now is has become so easy with “deb.js”.

Deb.js is a small file -- about 1.5KB -- but it cleans up the console window, so it's easier to debug JavaScript. It's the next necessity after FireBug and the built-in debuggers in Chrome, Opera, and Safari. The image shows a stack trace.

 

 

even you can add extension in your chrome browser which embed .deb() function in your java script code while loading and show error rights away in browser… wow !!

 

Detail: https://github.com/krasimir/deb.js

 

Add deb.js in chrome as extension: https://chrome.google.com/webstore/detail/debjs/egmeoknjmgikkkcdicmajkbkmkcmbiah

 

 

11 essential JavaScript tools for Web developers

11 essential JavaScript tools for Web developers

JavaScript's plan to take over the World (Wide Web) is well under way. But the explosion of tools leveraging JavaScript's ascendancy make choosing the right one for the job challenging, to say the least.

Here are 11 emerging tools for using JavaScript (in concert with other languages) to create modern websites with all the features users have come to demand. They offer clean design and simple interfaces that can be deceptive because the tools are often quite powerful, too. All of the years of evolution and redesign are paying off with tools that do more of what we want with fewer configuration hassles.

 

http://www.infoworld.com/slideshow/161868/11-essential-javascript-tools-web-developers-248463#slide1

 

 

Friday, August 22, 2014

When you save a list as a template do the workflows save with that template?

Issue:

When you save a list with workflow ( save web a site template), workflow get saved with list but it does not work.

 

Resolution:

When you create a workflow with Sharepoint designer it is associated to a specific list on a specific web.
When that web is saved site as template it includes the workflow but the workflow when you create site from
"Your" template are associated to the old list. You need to open the new site in Sharepoint Designer. Then open the workflow
in an editing session, click the xmol(from folder view (click all files in SPD)) file in the workflow folders then the "back" button then repick the list in the associations dropdown.
Save or finish or whatever., some other workflow references in each step may have to be reset as well (that part depends) particularily with cross list interaction.

If you find yourself doing this too often you need to develop in Visual Studio or try and figure out the XML declarative workflow files GUID or use an old third party codeplex project application that claims to auto associate those Sharepoint Designer designed workflows.

 

 

Abstract Class versus Interface

In this article along with the demo project Interfaces versus Abstract classes are discussed. The concept of Abstract classes and Interfaces is a bit confusing for beginners of Object Oriented programming. Therefore, tried to discuss the theoretical aspects of both the concepts and compare their usage. And demo project is attached with code.

Background

An Abstract class without any implementation just looks like an Interface; however there are lot of differences than similarities between an Abstract class and an Interface. Let's explain both concepts and compare their similarities and differences.

What is an Abstract Class?

An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards.

What is an Interface?

An interface is not a class. It is an entity that is defined by the word Interface. An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body. As one of the similarities to Abstract class, it is a contract that is used to define hierarchies for all subclasses or it defines specific set of methods and their arguments. The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesn’t support multiple inheritance, interfaces are used to implement multiple inheritance.

Both Together

When we create an interface, we are basically creating a set of methods without any implementation that must be overridden by the implemented classes. The advantage is that it provides a way for a class to be a part of two classes: one from inheritance hierarchy and one from the interface.

When we create an abstract class, we are creating a base class that might have one or more completed methods but at least one or more methods are left uncompleted and declared abstract. If all the methods of an abstract class are uncompleted then it is same as an interface. The purpose of an abstract class is to provide a base class definition for how a set of derived classes will work and then allow the programmers to fill the implementation in the derived classes.

There are some similarities and differences between an interface and an abstract class that I have arranged in a table for easier comparison:

Feature

Interface

Abstract class

Multiple inheritance

A class may inherit several interfaces.

A class may inherit only one abstract class.

Default implementation

An interface cannot provide any code, just the signature.

An abstract class can provide complete, default code and/or just the details that have to be overridden.

Access Modfiers

An interface cannot have access modifiers for the subs, functions, properties etc everything is assumed as public

An abstract class can contain access modifiers for the subs, functions, properties

Core VS Peripheral

Interfaces are used to define the peripheral abilities of a class. In other words both Human and Vehicle can inherit from a IMovable interface.

An abstract class defines the core identity of a class and there it is used for objects of the same type.

Homogeneity

If various implementations only share method signatures then it is better to use Interfaces.

If various implementations are of the same kind and use common behaviour or status then abstract class is better to use.

Speed

Requires more time to find the actual method in the corresponding classes.

Fast

Adding functionality (Versioning)

If we add a new method to an Interface then we have to track down all the implementations of the interface and define implementation for the new method.

If we add a new method to an abstract class then we have the option of providing default implementation and therefore all the existing code might work properly.

Fields and Constants

No fields can be defined in interfaces

An abstract class can have fields and constrants defined

 

Demo: http://www.codeproject.com/KB/cs/abstractsvsinterfaces/AbstractsVSInterfaces_src.zip

Monday, August 4, 2014

Microsoft .NET framework

The Microsoft .NET framework is a software framework for developing applications for Microsoft Windows although it was engineered in such a way so that other parties can develop the same framework for other operating systems.

The Common Language Runtime (CLR) is the executing engine of the .NET framework, it’s basically its core and the implementation of the Common Language Infrastructure (CLI). CLI is an open specification developed by Microsoft that defines how these core engines should be built, engines that among other things define common types, memory management and security. That way if an application is developed for one CLI (in the case of Microsoft, CLR) it can be run on any other OS running a version of the CLI.

Besides the core engine, the .NET framework includes many other class libraries that help developers create Windows applications and web applications. In order to develop applications the developer must choose a language. Two of the most popular .NET languages are VB.NET and C#. Both are object oriented (OO) although there are some aspects of OO not available to each language. Deciding which language to develop with depends on many variables, not least of which is your knowledge and comfort level with the language.

When you compile and build a .NET solution, whether it’s developed with VB.NET or C#, it’s converted to something called the Common Intermediate Language (CIL) also defined in the CLI.

The CIL is a lower level readable language that the CLR can execute but isn’t platform or processor specific. When executed by the CLR it converts the CLI code to the native code (machine code) for that processor. This means that you can develop one set of code and distribute across different systems that implement a version of the CLI.