SharePoint: Deep Diving with Cross Forest, Multi Forest Configuration and Additional Info

/* Posted January 22nd, 2009 at 10:00am [Comments: 1] */
/* Filed under C#, Microsoft, SharePoint */

Deep Diving with Cross Forest, Multi Forest Configuration and Additional Info

From Joel Oleson’s Blog URL: http://blogs.msdn.com/joelo/archive/2007/03/08/cross-forest-multi-forest-configuration-additional-info.aspx:

Background
The people picker works in cross domain or cross forest environment. It works in both-way trust and one-way trust environment.
Out of the box, if the admin does not do any configuration, the people picker will issue queries to all two-way trusted domains and two-way trusted forests to search people & groups.
The people picker uses the application pool account to search the target domains and forests. If the application pool account does not have permission to the target domains or forests, or the admin want to use different account to search the target domains or forests, the admin could should use
How to Configure
Don’t forget to run stsadm.exe –o setapppassword –password on all machines in the farm where SharePoint is installed

1. Run on every WFE.
stsadm.exe -o setapppassword -password

2. Run on one WFE
stsadm.exe -o setproperty -url ...

What we have found:

Read more »

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

Generate a .lib from a DLL with Visual Studio

/* Posted January 21st, 2009 at 7:43am [Comments: 2] */
/* Filed under C#, C/C++, Microsoft, Programming */

visual studio team system

Oftentimes programmers have to deal with external third party DLLs that their software rely on to function. This is both smart and useful because as long as the DLL interface remains the same, externally linked DLLs can be easily swapped in and out without having to recompile and rebuild code. However, linking code in Visual Studio with an external library requires that a .lib file exist – the DLL is actually not sufficient for this task. Fortunately, there is a way to generate a .lib from a DLL with Visual Studio. Creating the .lib file is a bit like reverse engineering the DLL’s symbols.

Read more »

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

SharePoint Search Web Service Error: Attempted to perform an unauthorized operation

/* Posted January 9th, 2009 at 8:29am [Comments: none] */
/* Filed under C#, Microsoft, SharePoint */

Server was unable to process request. —> Attempted to perform an unauthorized operation


queryService.Credentials = new System.Net.NetworkCredential(“username”,“password”,“domain”);

or you may want to try different passing

queryService.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

or

NetworkCredential networkCredential = CredentialCache.DefaultCredentials.GetCredential(new Uri(queryService.Url), “NTLM”);

or

queryService.Credentials = networkCredential;

queryService.Credentials = System.Net.CredentialCache.DefaultCredentials;
queryService.PreAuthenticate = true;

What we found the error to be was:
1. Check to make sure account you are logging in with has authority to do so.

2. Make sure that you are able to connect to the sites search service (IE, make sure its working properly) Try to connect to other search services to debug issue – Most times default credentials so not work and you will need to login.

You can try to use the Search Service tool here:
http://www.mosssearch.com/searchwebservice.html
But that only allows you to login with default credentials and may fail some of the time.

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

SharePoint C# – SecurityException: WebPermission Request Error

/* Posted June 16th, 2008 at 1:47pm [Comments: 6] */
/* Filed under C#, Microsoft, Programming, SharePoint, Windows */

Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type ‘System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

If you care getting the error above in SharePoint, there is a simple work around to get your code to work.

1. Open the wss_minimaltrust.config located: “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG”

2. Under the XML section <namedpermissionsets> and under the last <permissionset> add


<ipermission>
class="WebPermission"
version="1"
Unrestricted="true">
</ipermission>

3. Save the file and you are good to go!

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

c# Generate a Random Number

/* Posted June 10th, 2008 at 4:53pm [Comments: none] */
/* Filed under C#, Programming */

The following code snippet shows how to generate a random number between a range in C#, where min and max are minimum and maximum range of the new number.

private int RandomNumber(int min, int max)
{
Random random = new Random();
return random.Next(min, max);
}

How to use it?

Copy the above code in your class where you want to use it and call like this:

int returnValue = RandomNumber(5, 20);

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

Six recommendations for starting a startup with ASP.NET

/* Posted April 23rd, 2008 at 9:16am [Comments: none] */
/* Filed under C#, Microsoft, Programming */

ASP.net

1. Do use ASP.NET MVC (or at least learn the web like everybody else)

Don’t deal with ViewState, don’t deal with leaky abstractions of the web in a way that confounds you. You’ll thank yourself for writing cleaner code that you can test, and for mastering the deceptively simple art of web development. “It’s all just markup” is a mantra that will keep you on track when you feel overwhelmed with the new model, but it’s a new model you want to learn. If you don’t want to learn ASP.NET MVC, do yourself a favor and disable ViewState at the page level, and do what you can to avoid using it, whether that’s baking your own MVC-like “markup + business objects” design, or embracing the client-centric development model with JavaScript against ASP.NET controls that don’t require ViewState. Make friends with the Repeater.

Read more »

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

Using the using-statement

/* Posted April 21st, 2008 at 10:42am [Comments: 1] */
/* Filed under C#, Microsoft, Programming */

“Using statement?”, you may ask. “What is so interesting about that? I use it every day importing tons of namespaces!”
Well, i mean the other using statement; that one that results in a nice try..finally in IL, without having to write lots of code.

Well lets say you want to access a file, a database, or whatever resource that needs to be closed after usage:

Read more »

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

Reading XML into dataset / GridView c# : Read XML From URL

/* Posted April 7th, 2008 at 8:03am [Comments: 3] */
/* Filed under C#, Programming */

camping-xml-situps1.png

So recently I had to read an xml file and then bind it to a dataset/gridview. I knew there had to be an easy way. This is how I ended up doing it:

aspx

asp :GridView ID="gvDocActivity" runat="server" AutoGenerateColumns="false" /

Read more »

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

SharePoint Search Failing: Application Server job failed for service instance

/* Posted March 20th, 2008 at 11:36am [Comments: 1] */
/* Filed under C#, Microsoft, Programming, SharePoint */

Was getting this error:

Application Server job failed for service instance Microsoft.Office.Server.Search.Administration.SearchServiceInstance (34c9a339-ef4a-454b-a288-812fd2fd1270).
Read more »

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks

Problem with Aspose.word: System.AccessViolationException

/* Posted March 19th, 2008 at 9:22am [Comments: 1] */
/* Filed under C#, PC, PDF */

We were using aspose.PDF + aspose.word on our local dev computers and everything worked fine (windows 2k3 server 32bit)  We then deployed to our test server Windows 2k3 64bit and the site blew up. Read more »

  • Twitter
  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • Yahoo! Buzz
  • NewsVine
  • Facebook
  • Google Bookmarks