SharePoint C# - SecurityException: WebPermission Request Error

/* Posted June 16th, 2008 at 1:47pm [Comments: none] */
/* 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!

  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • NewsVine
  • Blogsvine
  • Facebook
  • Google
  • TwitThis

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);

  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • NewsVine
  • Blogsvine
  • Facebook
  • Google
  • TwitThis

Create ID Field in SharePoint List

/* Posted June 2nd, 2008 at 4:45pm [Comments: none] */
/* Filed under Microsoft, Programming, SharePoint */

This seams to be a common problem, and one that I get many calls from users about:

I have a query with our Sharepoint site and was advised that you were probably the best person to ask.

I have created a list under:

http://sharepoint/sites/department/Lists/ListName/AllItems.aspx

I need the first column (Issue ID) to be an automatically generated number but can’t seem to get it. Would it be possible for you to take a look and advise?

You can’t add a new unique auto-generated ID to a SharePoint list, but there already is one there! If you edit the “All Items” view you will see a list of columns that do not have the display option checked.

There are quite a few of these columns that exist but that are never displayed, like “Created By” and “Created”. These fields are used within SharePoint, but they are not displayed by default so as not to clutter up the display. You can’t edit these fields, but you can display them to the user. if you check the “Display” box beside the ID field you will get a unique and auto-generated ID field displayed in your list.

  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • NewsVine
  • Blogsvine
  • Facebook
  • Google
  • TwitThis

Windows 2008 and SharePoint 2007 Don’t Play Nice

/* Posted May 9th, 2008 at 4:24pm [Comments: 1] */
/* Filed under Microsoft, PC, Programming, SharePoint, Windows */

Recenlty i was trying to get a development environment setup on my new Windows 2008 computer, and was installing the typical Microsoft items. Little did i know that SharePoint 2007 wont install on Windows 2008:

Here is the error I ran into: Read more »

  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • NewsVine
  • Blogsvine
  • Facebook
  • Google
  • TwitThis

How to Automate your MySQL database backups

/* Posted May 5th, 2008 at 11:00am [Comments: none] */
/* Filed under PHP, Programming */

mysql

for automating backups, you can use this: http://www.mysqldumper.de/en/

\or you can run this automatic script

Here’s an essential automatic script and a cron job you will need in order to keep your backup automatic.

Yes, if you get a dedicated server, don’t get their stupid extra $15/month for backing up your database. (All they do is make scripts like this one and charge you for it)

You can follow this example and go spend that money on junk food.

So all you have to do is FTP your backup files.

This is way better than going into your phpMyAdmin and downloading from the web interface since the file is already ready for you to download.

Here’s how you do it:

1) Make a new file called backup.sh in your home directory. 2) Use the following syntax:

Read more »

  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • NewsVine
  • Blogsvine
  • Facebook
  • Google
  • TwitThis

How to widgetize your theme in Wordpress

/* Posted May 5th, 2008 at 10:52am [Comments: none] */
/* Filed under Blogging, Programming */

Make a file called functions.php in your theme directory. (if you don’t have one yet)

Add the following code and save the file:

if ( function_exists(’register_sidebar’) )
register_sidebar(array(
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ‘

‘,
‘after_title’ => ‘
‘,
));
?>

Then add the following anywhere you want to add dynamic widgets:

Read more »

  • Digg
  • del.icio.us
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Mixx
  • NewsVine
  • Blogsvine
  • Facebook
  • Google
  • TwitThis

“Column ordering” not showing up SharePoint List

/* Posted May 2nd, 2008 at 10:18am [Comments: none] */
/* Filed under Microsoft, Programming, SharePoint */

Missing the Column Ordering button on the List settings screen? Need to figure out how to move items around on the edit screen? Recently I ran into this issue where the “Column Ordering” option that was normally there went missing on a few of my lists.

Go to the list you want to edit
Click on any of the 3 links listed under the Columns section

  • Create column
  • Add from existing site columns
  • Indexed columns
  • In the URL bar, replace the aspx page with “formEdt.aspx” and that will bring you to the Column ordering section.

    Read more »

    • Digg
    • del.icio.us
    • Propeller
    • Reddit
    • Slashdot
    • StumbleUpon
    • Technorati
    • Mixx
    • NewsVine
    • Blogsvine
    • Facebook
    • Google
    • TwitThis

    Emacs Keyword Syntax Highlighting for Verilog, Specman Elite

    /* Posted April 28th, 2008 at 4:04pm [Comments: none] */
    /* Filed under Programming, Reference */

    If you’re an avid Unix user you’ve probably used Emacs at one point or another. Ever wonder how sometimes when you open up a file (like .cpp) the editor is able to highlight and color all the right keywords pertaining to the programming language the file is coded in? The secret is in the .emacs file located in your home directory. I’ve worked with both Verilog and Specman Elite files before, and found the correct code to add in the .emacs file to enable the beautiful keyword syntax highlighting/coloring that makes the code much more readable. Read more »

    • Digg
    • del.icio.us
    • Propeller
    • Reddit
    • Slashdot
    • StumbleUpon
    • Technorati
    • Mixx
    • NewsVine
    • Blogsvine
    • Facebook
    • Google
    • TwitThis

    Advanced CVS and SVN Tips and Tricks

    /* Posted April 28th, 2008 at 3:29pm [Comments: none] */
    /* Filed under Programming, Reference */

    CVS and SVN logos

    I’m listing a few tips and tricks for CVS and SVN that I’ve learned through the years. You’re required to at least have some basic knowledge, this list isn’t a basic usage guide. It’s not a list of basic tips either. These are specifically purposed advanced usage scenarios and the appropriate commands to execute to achieve them. Now that you’ve been informed, let’s start. Read more »

    • Digg
    • del.icio.us
    • Propeller
    • Reddit
    • Slashdot
    • StumbleUpon
    • Technorati
    • Mixx
    • NewsVine
    • Blogsvine
    • Facebook
    • Google
    • TwitThis

    Apple releases fourth iPhone SDK

    /* Posted April 25th, 2008 at 2:08pm [Comments: none] */
    /* Filed under Apple, Programming, iPhone */

    iPhone SDK sample applications

    Apple has announced the release of the fourth beta version of its popular iPhone software development kit (SDK).

    Apple’s developer website explains:”The fourth beta version of the iPhone SDK includes Xcode IDE, iPhone simulator with Open GL ES support, Interface Builder, Instruments, frameworks and samples, compilers, and Shark analysis tool”. The SDK also promises to improve “Audio Toolbox, NSXML Parser support and redesigned UIFont.”

    The announcement came during the second quarter financial results press conference call where Apple executive discussed the SDK and future releases. The company says they have been in contact with over 200 Fortune 500 companies as well as 400 higher education institutions that are applying to become iPhone developers.

    Apple CFO Peter Oppenheimer added that the company has already signed up 200,000 developers.

    • Digg
    • del.icio.us
    • Propeller
    • Reddit
    • Slashdot
    • StumbleUpon
    • Technorati
    • Mixx
    • NewsVine
    • Blogsvine
    • Facebook
    • Google
    • TwitThis

    Anything Geeky Goes!

    Highlights

    Featured Wii

    Featured iPhone

    Featured PSP/PS3

    Featured A/V

    Related Links

    Products Highlight

    Archives