Technical blog archive

.NET King Technical blog
 This is the real Alireza! jumping from one technology to another every day. Here you can read my technical blogs. Just select the right category and enjoy.
 By the way, don't miss the general blog.


How to restore SQL Server 2005/2008 master database (1/2/2012)
This is my first video on YouTube.
9 comments by now. Add your comments
Anonymous access for SharePoint 2010 application pages (12/14/2011)

Problem: We would like to create an application page that doesn't require login and any user can open that.

1. Make sure the website that calls the application page is available for anonymous access.
If the URL to the application page is http://server01/_layouts/testpage.aspx, then http://server01/ has to be accessible by anonymous user.

2. When you create an application page in Visual Studio 2010, by default when you open the page in view code, you see the class below:

public partial class testpage : LayoutsPageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
}

LayoutsPageBase by default fires the login prompt. So just replace it with equivalent class that can be called in an unsecure context. That class is UnsecuredLayoutsPageBase.

So your code should look like this.

public partial class testpage : UnsecuredLayoutsPageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
}

3. UnsecuredLayoutsPageBase has a read-only property called AllowAnonymousAccess. This property returns false by default which leaves you with an extra step to override it and make it return true. So your final code will look like this:

public partial class testpage : UnsecuredLayoutsPageBase
{
    protected override bool AllowAnonymousAccess
    {
        get
        {
            return true;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
    }
}

Deploy the page and enjoy opening the page without login prompt.

OK, I have done this but it still prompts me for the login info! Well the only other thing that I can think about now is go to the site settings and make sure the master page as a published and approved version.

Note: All the credit of this post goes to Dr. Zewei Song and Kevin Chen. I have just packaged and formatted their work.  

Cheers
Alireza

0 comments by now. Add your comments
Cannot delete content type in SharePoint 2010 - Error: The content type is in use (9/10/2011)

You try to delete a content type in SharePoint 2010 and this is what you see:

Lets review the possible reasons. This error happens when there is a dependency or another object in SharePoint that uses the content type:

  1. A list/library that is already using the content type.
  2. Items in the list/library that use the content type.

OK, we dropped the items that use that content type and we removed the content type from the list/library but still we see the same darn screen when trying to get rid of the content type!
What else can possibly use this content type?
The answer is simple: the same items or libraries that you deleted are still using that content type in RECYCLE BIN. Clean up both recycle bins (user and administrator) and then happily wipe off the ugly content type.

Cheers
Alireza

1 comments by now. Add your comments
SharePoint Trainer website launched! (1/17/2011)
Finally I completed the SharePoint trainer website and now I am getting back to Training industry. I finally realized that nothing satisfies me better than being in the class and teaching technology. I am definitely a better trainer compared to what I was before because now I am bringing the valuable experience of the consulting world to my classes. Knowing this means that I am not leaving the consulting world for ever. Still I accept consulting assignments, but short term ones and open more time for class delivery of the courses.
To attend my SharePoint, SQL Server and ASP .NET classes, visit www.sharepointtrainer.ca.
3 comments by now. Add your comments
BOOTMGR is missing (12/2/2010)
Yesterday I was dealing with BOOTMGR is missing. It was quite embaressing considering that I had to use the same laptop to present SharePoint 2010 for next week presentation. Anyway this post saved me and I would like to Shareit with you.
You can find the original post here http://forums.techarena.in/operating-systems/1128154.htm#post4749998

10 step FIX Windows 7 [all versions]

1.) Boot from "WINDOWS 7" DVD;
2.) Select "Repair computer";
3.) Select "Cancel" to exit the repair wizard;
4.) You will now get a screen which displays 'command prompt','system restore','memory diagnostics',etc......
5.) Select "command prompt";
6.) Type your "DVD-DRIVE LETTER" in command prompt, press ENTER;
7.) Now if your Windows 7 is installed in C drive, type "copy bootmgr c:\" without codes, press ENTER;
8.) After successful copy type "exit" without codes, press ENTER;
9.) Reboot computer;
10.) Select "start windows normally";
*****NOW YOU ARE DONE*****

Cheers
Alireza
0 comments by now. Add your comments
You cannot use SharePoint. Your system administrator has turned off the feature. (11/2/2010)
Today I was trying to connect to SharePoint 2007 from Outlook 2010 and I got the error saying “You cannot use SharePoint. Your system administrator has turned off the feature.”
The SharePoint foundation features were enabled on office and the same feature was working like a charm on another machine with the Office 2010. It didn’t take long to find an answer on the net for similar issue with Office 2007 and the same applies to the Office 2010.
By the way SharePoint foundation feature in Office 2010 has nothing to do with this issue. Our server is SharePoint 2007 and at that time SharePoint foundation was not born :D


Solution:
1.On the command-line and run REGEDIT
2.Go to HKEY_CURRENT_USER/Software/Microsoft/Office/14.0/Outlook/Options/wss
3.Double-click on the disable and set the Value data to 0 and click ok.
4.Enjoy the rest of the day.
Special thanks to Jose Baretto.

Cheers
Alireza
3 comments by now. Add your comments
Visual Studio 2008, ASP .NET and Crystal Report (2/12/2010)

It is interesting that the article "Crystal Reports in ASP .NET Web Applications" is the most viewed page on my website. Although it is not the latest version of Crystal Reports and Visual Studio, the code is still valid with Visual Studio 2008. Now with YouTube and all new video technologies I am thinking of making a video about using Crystal Reports in ASP .NET 3.5 and new components available in the new product.
It is coming soon, Stay tuned.
Cheers
Alireza
 

5 comments by now. Add your comments
How to change the size of Quick Launch menu in SharePoint (2/8/2010)

Assuming that you are using the default master page, the size of the quick launch menu is fixed 150X400 pixels. If the content is anything more than this size it automatically adds scroll bars. To change size of this area open the default.master in SharePoint designer. Go to the code view and find SharePoint:SPRememberScroll tag. The style attribute has the size of the quick launch area.

Here is the default value

Style="overflow: auto;height: 400px;width: 150px; "

 

Simply change it to anything you like:

Style="overflow: auto;height: 400px;width: 250px; "

Cheers
Alireza

4 comments by now. Add your comments
First Look at SharePoint 2010 – Presented by Savash Alic (10/21/2009)
If you live in Toronto, this is a great chance to get familiar with this new monster called SharePoint 2010. Don't miss it. See the event details here.
Cheers
Alireza
0 comments by now. Add your comments
.NET Framework is 7 years old today (2/13/2009)
Seven years ago on February 13, 2002 Microsoft released the first version of .NET Framework . Lets have a quick look at the .NET Framework evolution:
In 2002 Version 1.0 was released with Visual Studio .NET
In 2003 .NET Framework 1.1 was released embeded in Windows 2003 Server. (Operating system relies on .NET Framework)
In 2005.NET Framework 2.0 was releases with Visual Studio 2005 and SQL Server 2005. (Relational Database engine relies on .NET Framework)
In 2006 .NET Framework 3.0 was released enbeded in Windows Vista and Windows Server 2008. (Client desktop relied on .NET Framework)
In 2007 Microsoft releases .NET Framework 3.5 with Visual Studio 2008 and Windows 7.
Happy Birthday .NET. You are growing fast!
Cheers
Alireza
6 comments by now. Add your comments
SQL Server 2008, Ideal for developers (2/11/2009)
I read this article some time back and I really enjoyed it. It reveals the sexiest features of SQL Server 2008 for techies and especially developers. Can anybody show me an articled that explains the value of SQL Server 2008 for executies? In better word I need something that can explain the value of this amazing product for decision makers who are not technical.
Cheers
Alireza
2 comments by now. Add your comments
Is SharePoint branding important? (2/10/2009)
It sounds like a silly question but look at the answer from developers’ perspective.
“Branding!? Is branding giving you any functionality? So why shall I waste my time on branding?”
A trainer will possibly say:
“Branding and UI customization makes the product look different from the original look different and makes the learning costly”
Here is my challenge: “Is SharePoint a product?” I can say MOSS is a product but most of the developers look at WSS just as a platform. When a developer builds a product on SharePoint platform, then it is not SharePoint. Now branding gives context to data and makes turns it into information. The branding that brings the user to the right context is critical to deliver the information in the right way and result in right reaction from information workers. In better word just because we are not graphic desighers doesn’t mean that we can take their work for granted!!!!
Cheers
Alireza
3 comments by now. Add your comments
 

 -