Tuesday, February 11, 2014

Windows Azure

Recently, I was researching about Windows Azure benefit from msdn to see how it would add value to our dev team. All the msdn subscribers get some free credits that they can use to start exploring cloud development. Here are some things, that I was able to do. Create a new website, a new SQL database and a new VM with Windows Server 2012 R2 all within minutes. It is all pretty straightforward and you can get started on it with a few clicks. I had to provide the mobile number for Microsoft to text some confirmation code in the sign up process. I was able to connect to the Windows Azure SQL Database from SQL Server 2012 Management Studio with no major issues. I had to enable the firewall on the Azure portal to allow the IP address, though.

Budget Tracking Template

Few months back, I got a request to create a site using Budget Tracking Template on our SharePoint 2010 Farm. Initially, I got the following error, when I tried to do it.
Then, I researched and found that the following IssueTrackingWorkflow was not activated on our Site Collection. I got the Features listing from this blog. and looked up the Feature, the error was talking about using this list. Next, I had to go to the Site Collection features of the root site collection with Farm Admin credentials and activate the workflow there. Creating the site after doing that had no issues. http://blogs.msdn.com/b/mcsnoiwb/archive/2010/01/07/features-and-their-guid-s-in-sp2010.aspx

Wednesday, March 13, 2013

RadCompression and SharePoint Designer

For some reason when I added RadCompression related entries to my config file in SharePoint, I was not able to connect to that site in Sharepoint Designer or open any page in it. The login credentials popup was in an endless loop. Commenting those entries made the issue go away.

Thursday, October 04, 2012

Ajax Control Toolkit Masked Edit Extender

Masked Edit Extender

I had a need to use the Masked Edit Extender to limit the number of decimals entered by the user on a Form. It worked great except that I could not get the value of the TextBox that I targeted the extender on the client side. I was only able to get the masked value.

I searched the web and could not find a solution. I ended up writing my own Javscript function to unmask it. It may not be perfect, but works for me. I hope this helps someone.








Formatting Numbers for decimals

Javascript: We can use Number.toFixed(x) to format any number for "x" number of trailing decimals in Javascript In .NET we can use the String Formatting while Databinding the element. See example below for GridView.

Monday, August 27, 2012

Disable Postback using Javascript



'asp:button onclick="btn1_Click" onclientclick="return VerifyCondition(this);" runat="server" tabindex="1" text="Sample Button"'>;

function VerifyCondition()
{ var xxdropdown = document.getElementById('<%= ddlXX.ClientID %>');
  var selectedxx = xxdropdown.value;
   if (selectedxx == '0')
   { alert("Please select a value before proceeding.");
     return false;
  }
 else
 {
     return true;
 }
}

Wednesday, July 25, 2012

SharePoint's Hidden User List

This morning I got a weird HelpDesk request. A user's first name was incorrectly put in Active Directory. The user logged in to SharePoint which used Windows Authentication. Everything was good except that the User, ofcourse noticed his name spelled wrong and notified helpdesk to fix it.

It was fixed in Active Directory but was not pulling over to SharePoint side. The first spot I checked was User Profiles...but fixing it here had no effect...deleted the user profile and synced it back up...no effect....

Then I stumbled upon this post which shed light on what was happening.


http://zimmergren.net/technical/sharepoints-hidden-user-list-user-information-list

So, this is what I did to fix the issue, basically browsed to our User Listing by typing /_catalogs/users/simple.aspx from our SharePoint site...found the user in question and deleted the user from the site collection, which removed the user from all the security groups he belonged to earlier, which is cool.

Finally adding him back to the required security groups got him in with his name spelled correctly.

Wednesday, May 30, 2012

Disable Mouse Wheel Zoom

Visual Studio 2010 started behaving weird suddenly. It would zoom the text when using the mouse wheel. Could'nt find the option to disable it. Stumbled across this article and now I know that pressing Ctrl disables it.

http://visualstudiogallery.msdn.microsoft.com/d088791c-150a-4834-8f28-462696a82bb8/ Pressing Ctrl followed by mouse wheel move enables it in the IDE.​

WCF Timeout Issues

When I first converted my SharePoint Webpart to use the locally deployed WCF service, no compile errors occured.

However, when I deployed the webpart and started testing, timeouts were occuring and the page was not responding.

Researched this and found the following information useful.​ http://stackoverflow.com/questions/981475/wcf-timeout-exception-detailed-investigation

This is what I did:

1)On the Sharepoint Web.config file on my development server: Set the following: maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" Also, in the clientcode(webpart code) did the following:

2) Set the following in In Page_load: //This says how many outgoing connection you can make to a single endpoint. Default Value is 2 System.Net.ServicePointManager.DefaultConnectionLimit = 200;

3)Made sure all the WCF client objects are closed in a finally block after the WCF calls are made. Even in cases where Channels were used, closed the channel in the finally after the WCF service call was made.
The close channel has the following code where _wcfAccess is the channel created.

if (_wcfAccess != null) { ((IClientChannel)_wcfAccess).Close(); ((IDisposable)_wcfAccess).Dispose(); _wcfAccess = null; }

Inspite of having all the above in place, I ran in to an issue where my web page froze up for an indefinite period of time.The page had a call to a WCF service that should return a record. I saw the "Server too busy" exception in the diagnostics log when the above happened.

I researched and stumbled on this thread. http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/745b95d2-1480-4618-89f5-1339d6ee228d/ I was going to try the above, when I found out the below. It turns out that there was a bug in the Database code that it was returning multiple records or a Dataset instead of one record.

The WCF call then took forever to finish receiving this and the Receive Timeout on the Binding Element for the WCF contract in question was set to 10 minutes(by default) and so the page froze up for this long.

Ajax Update Panel and Required Field Validators

Ran in to an issue this morning, where the cancel button's causesvalidation="false" property was not functioning correctly.

Basically the whole page froze up if the validation failed. This(validator) was inside a formView inside an Update Panel on a Sharepoint WebPart. Researched and found this, which gave me pointers to try.

http://www.codeproject.com/KB/ajax/UpdatePanel_Validation.aspx

Finally, adding EnableClientScript="false" to the Required Field validator made the cancel button work properly.​

Enable Debugging in SharePoint

In WSS 3.0/MOSS 2007 to enable debug information we have to modify only the web.config related to your web application.

Instead, in SharePoint 2010, we have to modify two different web.config files:

1.the one that you can find in the root directory of the web application in which you want to debug you customizations (the file at the path: [drive]:\inetpub\wwwroot\wss\virtualdirectories\[port])

  2.the one that you can find into the "LAYOUTS" directory under the SharePoint root (the file at the path: [drive]:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS)

What remains unchanged from the previous version of SharePoint are the number of attribute to change in the web.config file:

•The "debug" attribute of the "compilation" element has to be set to "true"
•The "callstack" attribute of the "safemode" element has to be set to "true"
•The "mode" attribute of the "customerrors" element has to be set to "off"

This is from this site: http://www.dev4side.com/community/blog/2010/8/16/how-to-enable-debug-information-over-exceptions-on-sharepoint-2010.aspx

Enable SessionState in Sharepoint

1) Open SharePoint 2010 Management Shell (As Administrator) and type the following command:

Enable-SPSessionStateService –DefaultProvision.

2) To resolve the error and to enable session state for SharePoint there are two entries that need to exist in the web.config file.

The first is to ensure that enableSessionState is set to TRUE.

...<..pages enableSessionState="true" enableViewState="true" enableViewStateMac="true" validateRequest="false" pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" asyncTimeout="7"..>..

The second is to ensure that the remove and add lines exist in the modules section for Session.

..<..modules runAllManagedModulesForAllRequests="true"..>.. …
.<.remove name="Session" ./>. .<.add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="" ./>. … modules>

ALSO,Additional steps to ensure the "web.config"
1.Add to the configuration/system.webServer/modules element.
2.Set the enableSessionState attribute of the configuration/system.web/pages element to true.
3.Add to the configuration/system.web element


3) Reset IIS.

Enable Diagnostics in WCF service

Add these entries to the web.config file of the WCF service site(application) in question.




Consume the service. After the operation is complete or errors out, open the log file at the above specified location on the machine hosting the service to see the issue.

]] Comment this section when not in use to make sure it does not affect performance.

Also, make sure you set the includeExceptionDetailInFaults attribute to true in the WCF config file to see the root error.

Javascript Error

http://sympmarc.com/2010/08/28/how-to-fix-sys-argumenttypeexception-object-of-type-sys-_application-cannot-be-converted-to-type-sys-_application-error/​

Microsoft JScript runtime error: Object expected

It turns out I was missing a curly brace in Javascript. This post saved me lots of time. http://social.msdn.microsoft.com/Forums/en-US/netfxjscript/thread/eede0ba6-1e1d-4248-98bb-6383839dfac7/​

Raising Javascript Event in ASP.NET user control

Raising Javascript Event in ASP.NET user control http://stackoverflow.com/questions/389450/raising-javascript-events-in-asp-net-user-control Server Side Method() { Server side code... this.Controls.Add(new LiteralControl("")); } This will execute the server side code​ and print the document next. We can even call this at the beginning/end of Page_load or after some server code is executed.

WCF Service Troubleshooting

WCF Service Troubleshooting tips

http://www.infosysblogs.com/microoft/2009/06/troubleshooting_wcf_service_ap.html

http://msdn.microsoft.com/en-us/library/ms731055.aspx

http://stackoverflow.com/questions/399847/net-memory-profiling-tools

Thursday, March 29, 2012

Assigning Guids to variables in C#

Assigning Guids to variables in C#

Guid invt_id = new Guid("abcd-efg-etc.....Any Guid String");
Guid invt_id = Guid.Empty;