Saturday, June 1, 2013

Server Error in ‘/’ Application. Runtime Error in SharePoint

Open web.config file


1. C:\inetpub\wwwroot\wss\virtualdirectories\” modify the web.config file

a. In customErrors tag set mode="Off" to "On
b. In SafeMode tag set CallStack="true" to false
c. In Compilation tag Debug="false" to true

2.If still you are facing default error page then follow below change
In the layouts directory underneath the SharePoint root directory or 14 hive – C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS

a. In customErrors tag set mode="Off" to "On
b. In SafeMode tag set CallStack="true" to false
c. In Compilation tag Debug="false" to true

Wednesday, July 18, 2012

Turning off custom errors in for debugging in SharePoint 2010



As a developer, one of the first things I do after I have setup a web application & site collection is:
Open the web.config (“C:\inetpub\wwwroot\wss\VirtualDirectories\(port)”) and set:

1.change batch and debug to true - (compilation batch="true" debug="true" )
2.change CallStack=”true” in safe Mode tag - (SafeMode CallStack="true")
3.Change CustomErrors=”Off”
However when I ran into exception, instead of getting the detailed message I was expecting, I ended up getting the infamous message telling me to change the customerrors setting in the web.config so that I can see the details:

Server Error in '/' Application.

After embarassingly long time I figured out there is another web.config in _layouts directory - C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14

Custom errors need to be turned off here too.

Friday, June 3, 2011

MVC vs MVP

Last month I happened to stumble on this question from different people as to what is the difference between MVC and MVP. Representing here diagrammatically for a quick look

MVC PATTERN



MVP PATTERN

Friday, February 4, 2011

Writing an Extender Control

To write your own Extender Control, I am using Microsoft Ajax Library.
This location below has a powerpoint presentation and a zip with a demo code.
The power point presentation talks some basics about Microsoft Ajax Library key components and the demo shows how to make an extender control.

Please remember to select extender control template while creating extender control in Visual studio. It will save you lot of configuration lines that you might have to write otherwise.

https://docs.google.com/leaf?id=0B_ZpzrhCCVOoNTE0N2ZkMDktNWQ5Yy00ZTIwLTg4ZTAtY2Y5YjE0ODEyYTYy&hl=en&authkey=CIqq8CQ

Tuesday, December 28, 2010

Ajax Library – Event Handling

System.ComponentModel.EventHandlerList - to add custom events to an object


To add custom events to an object, you add an instance of Sys.EventHandlerList into another object and expose public methods off that object that manipulate the instance. (Table 2.5 details the methods we use to manipulate the Sys.EventHandlerList type.)

How to add a custom event.

For instance I have an array notes[]. When I add a note I want to add an event, that shows an alert. To do this
1. Create an instance of Sys.Event.HandlerList. This instance holds list of handlers with their associated events.

_events=new Sys.EventHandlerList();

_events.addHandler("noteadded", functionName);


addHandler method adds the event name and function name to be executed on raise of that event.


How to raise this custom event


For this whenever a note is added following code needs to be written


var handler= _events.getHandler("notedded");

If(handler!=null)

handler(this,Sys.EventArgs.Empty)


2. To pass arguments of your own you need to create a class and inherit from Sys.EventArgs
Example
NotebookNamespace.NoOfNotesEventArgs=function(numOfNotes)
{

This._noOfNotes=numOfNotes;
}
NotebookNamespace.NoOfNotesEventArgs.prototype= {

Get_noOfNotes : function()

{

return this.noOfNotes;

}
}
NotebookNamespace.NoOfNotesEventArgs.registerClass("NotebookNamespace.NoOfNotesEventArgs", Sys.EventArgs)

Another this worth mentioning here is Sys.UI.DomEvent.
The Sys.UI.DomEvent class provides cross-browser access to DOM element event properties and methods to work with DOM element events
Some familiar methods of this class are $addHandlers, clearHandlers, preventDefault etc

Example

Var btn=$get("button1");

$addHandler(btn,{"click":button1_clickHandler});

However this has a problem of maintaining scope. The example below will tell you what I mean.

<html>
<body>
<form id="form1" runat="server">
<input type="button" value="btnTest" id="test" />
<asp:ScriptManager ID="scrptMgr" runat="server" />
</form>
<script type="text/javascript">
MyObject = function() {
this._name = "Deepa";
};
MyObject.prototype = {
clickEventHandler: function(e) {
alert (this._name);
}
};
var myObject = new MyObject();
$addHandler($get("btnTest"), "click", myObject.clickEventHandler);
</script>
</body>
</html>

The code looks like it will alert "Deepa". But it alerts "undefined"

That is because when event handler clickEventHandler executes, this points to the testButton and not the class MyObject.
To correct this we use Delegate provided by Microsoft Ajax Library

To create the delegate, we use the Function.createDelegate method, as
follows:
var del = Function.createDelegate(<instance>, <methodName>);

In the evenHandler i.e. <methodName> here, this will refer to <instance>

Hence with below code, "Deepa" will be alerted when clickEventHandler is executed

var myObject = new MyObject();
var dele =Function.createDelegate(myObject, myObject.clickEventHandler);
$addHandler($get("btnTest"), "click", dele);

Tuesday, November 30, 2010

.Net Framework 4.0 – What’s new

What are the major improvements provided by the common language runtime and the base class libraries?

Brief about the Improvements -

Diagnostics and Performance - Starting with the .NET Framework 4, you can get processor usage and memory usage estimates per application domain. 

Garbage Collection - This feature replaces concurrent garbage collection in previous versions and provides better performance.

Code Contracts - Code contracts let you specify contractual information that is not represented by a method's or type's signature alone. The new System.Diagnostics.Contracts namespace contains classes that provide a language-neutral way to express coding assumptions in the form of preconditions, postconditions, and object invariants.

Design-Time-Only Interop Assemblies - You no longer have to ship primary interop assemblies (PIAs) to deploy applications that interoperate with COM objects. In the .NET Framework 4, compilers can embed type information from interop assemblies, selecting only the types that an application (for example, an add-in) actually uses.

Dynamic Language Runtime - The dynamic language runtime (DLR) is a new runtime environment that adds a set of services for dynamic languages to the CLR. The DLR makes it easier to develop dynamic languages to run on the .NET Framework and to add dynamic features to statically typed languages. To support the DLR, the new System.Dynamic namespace is added to the .NET Framework. 

Covariance and Contravariance - Several generic interfaces and delegates now support covariance and contravariance.

BigInteger and Complex Numbers - The new System.Numerics.BigInteger structure is an integer data type that can store fairly large number as it has no upper and lower bound values.Complex types represents a complex number of form a + bi. IT supports arithmetic and trigonometric operations with complex numbers.

Tuples - The .NET Framework 4 provides the System..::.Tuple class for creating tuple objects that contain structured data.

File System Enumeration Improvements - You can now enumerate directories and files by using methods that return an enumerable collection of strings of their names.ou can also use methods that return an enumerable collection of DirectoryInfo, FileInfo, or FileSystemInfo objects. 

Memory-Mapped Files - A memory-mapped file contains the contents of a file in virtual memory and is an application’s logical address space. So You can use memory-mapped files to edit very large files and to create shared memory for interprocess communication.

64-Bit Operating Systems and Processes - You can identify 64-bit operating systems and processes with the Environment.Is64BitOperatingSystem and Environment.Is64BitProcess properties.

Pasted from <http://www.dotnetcodes.com/dotnetcodes/code/Articles-55-Net-framework-40-major-improvements.aspx>

Monday, November 15, 2010

My 2 hour weekend experience after the weekend

My weekend is generally busier than the whole week. My lovely endearing little princess keeps me on my toes through out Saturday and Sunday. Actually she literally wants to be on my lap all the time.

I have already given up doing tasks that I consider NECESSARY, however to finish out "THE ABSOLUTELY NECESSARY" tasks of the day like brushing my teeth, taking bath etc I get up early on the weekend so that I am done by the time she is awake.

By being so demanding of me, she actually makes me feel so very special. All she wants is her MOMMMYYYY and I feel so loved so much wanted for and so nice :). And so Sunday night I am totally exhausted, my left forearm, the region near Ulna gets swollen and my feet are on fire.

No doubt the Monday blues get worse for me. And I really need lot of will to start for office. Today was no different "Monday" and my hubby down with fever adding to the "BLUES". On my way to office an inner voice told me hey Super Women (I consider all working mothers super women) you need a break too!!!! You deserve a VACATION. And I was like OKK!!!... but is there something that can give me a VACATION experience in 2 hrs (an affordable time I could be out of office)??.....Inner voice answers - A SUPERB SPA ......My heart jumped and my car took a left turn for the parlor.... A WOW Experience :).....

A message to all superb women ... Listen to your inner voice, find time for yourself and get a WOW experience :)