Listed below is a C# example of programmatically querying the group(s) a user belongs to on a SharePoint 2003 site:
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
private boolean IsContributor()
{
boolean bContributor = false;
SPWeb currentWeb = SPControl.GetContextWeb(this.Context);
SPRoleCollection currentRoles = currentWeb.CurrentUser.Roles;
foreach(SPRole myRole in currentRoles)
{
strRoles = myRole.Name.ToString();
if (strRoles == "Contributor")
{
bContributor = true;
break;
}
}
return bContributor;
}
Wednesday, May 31, 2006
"File or assembly name Microsoft.VisualBasic.Compatibility, or one of its dependencies, was not found."
I had an windows application that was converted from Visual Basic 6.0 to VB.Net 2003. After it ran fine in development, I moved to production where I received the following error "File or assembly name Microsoft.VisualBasic.Compatibility, or one of its dependencies, was not found."
Since the application was converted from an older version of VB and uses some legacy functions, it requires "Microsoft.VisualBasic.Compatibility.dll". This library was originally found on the development machine in C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322, but was not found on the production server.
The easiest way to resolve this is simply to copy the .DLL into the working directory of the application. The .DLL can also be packaged with the project installation to avoid the same issue from repeating with future installs.
Since the application was converted from an older version of VB and uses some legacy functions, it requires "Microsoft.VisualBasic.Compatibility.dll". This library was originally found on the development machine in C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322, but was not found on the production server.
The easiest way to resolve this is simply to copy the .DLL into the working directory of the application. The .DLL can also be packaged with the project installation to avoid the same issue from repeating with future installs.
Preventing Timeout while debugging XML Web Services
When debugging XML Web Services, an exception appears indicating the operation has timed out. To resolve this problem, set the TimeOut property on the XML web service object to -1. This will set it to infinite timeout.
This tip was found in "Debugging Applications For Microsoft .Net and Microsoft Windows"
This tip was found in "Debugging Applications For Microsoft .Net and Microsoft Windows"
Friday, May 26, 2006
"It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual"
Q: I have an ASP.Net application that when launched produces the following error:
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
What can I do to resolve it?
A: This could be do to the virtual directory not being configured as an application.
To create an Application using a Virtual Directory, use the following procedure.
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
What can I do to resolve it?
A: This could be do to the virtual directory not being configured as an application.
To create an Application using a Virtual Directory, use the following procedure.
- Open the IIS Manager (inetmgr.exe)
- Right click on "Virtual Directory" and select "Properties".
- Click on the "Create" button.
The Virtual Directory is now configured as an Application and the ASP.Net should work as expected. If not there maybe a conflict with the settings in the Machine.config file.
Wednesday, May 17, 2006
Microsoft Expression Products
Microsoft has released a new product line called Expression, targeting web designers and developers. The product line up consists of 3 products:
For more information or to download a trial version, visit the Expression home page at http://www.microsoft.com/products/expression/en/default.mspx
- Expression Graphic Designer: used for creating vector or pixel-based rich graphics with texture and dimensions
- Expression Interactive Designer: for creating an engaging and interactive interface using multi-media.
- Expression Web Designer: used for building optimal web sites using a visual designer and leveraging ASP.Net, XML, and XHTML.
For more information or to download a trial version, visit the Expression home page at http://www.microsoft.com/products/expression/en/default.mspx
Tuesday, May 16, 2006
Microsoft Expression Web Designer
Today Microsoft has released the beta version of Expression Web Designer. It is intended to replace Frontpage, which is being phased out of the product lineup.
In addition, Expression Web Designer will also offer reporting tools for web developers to help identify sites where Cascading Style Sheets are causing errors, accessibility of the site to handicapped Web users, and how many errors users of older Web browsers are encountering when viewing the site.
To download the CTP (Community Technology Preview) beta version, go to http://www.microsoft.com/products/expression/en/web_designer/wd_free_trial.aspx
In addition, Expression Web Designer will also offer reporting tools for web developers to help identify sites where Cascading Style Sheets are causing errors, accessibility of the site to handicapped Web users, and how many errors users of older Web browsers are encountering when viewing the site.
To download the CTP (Community Technology Preview) beta version, go to http://www.microsoft.com/products/expression/en/web_designer/wd_free_trial.aspx
Thursday, May 11, 2006
Generating a GUID
Q: How can I create a unique value without using a counter?
A: The .Net framework provides a method for generating a universally unique identifier or GUID and can be accessed as shown below:
Dim strGUID as String = System.GUID.NewGuid().ToString()
GUID is short for Globaly Unique Identifier. This number is
based on IP address, MAC address, and date/time. It's represented as a series of alpha-numeric characters in the format {8-4-4-4-12}.
Using the NewGuid() method allows unique numbers to be generated by one function call, without concern for repeating identifiers or counters.
A: The .Net framework provides a method for generating a universally unique identifier or GUID and can be accessed as shown below:
Dim strGUID as String = System.GUID.NewGuid().ToString()
GUID is short for Globaly Unique Identifier. This number is
based on IP address, MAC address, and date/time. It's represented as a series of alpha-numeric characters in the format {8-4-4-4-12}.
Using the NewGuid() method allows unique numbers to be generated by one function call, without concern for repeating identifiers or counters.
Wednesday, May 10, 2006
C# in SQL Server 2005 Reporting Services
Q: I know that VB.Net functions are available in SQL Server 2005 RS (Reporting Services), but does it also accept C# commands?
A: The expression language for Reporting Services is VB.Net only. You can call an assembly that contains functions written in C#. This is a very valid option, but the call from within the report will be with the VB.Net syntax.
Thanks to Mike Shelton (Microsoft) for answering this question.
A: The expression language for Reporting Services is VB.Net only. You can call an assembly that contains functions written in C#. This is a very valid option, but the call from within the report will be with the VB.Net syntax.
Thanks to Mike Shelton (Microsoft) for answering this question.
Tuesday, May 9, 2006
MS Certification Courses
Q: Where can I take a class that would be geared toward certification in either .NET forms or ASP.Net? I interested in exams 70-315 or 70-316.
A: Check out this link (http://www.microsoft.com/learning/mcp/mcsd/requirementsdotnet.asp). It lists the tests needed for passing the MCSD along with MS courses. You can register with these exact same course numbers at CCC or CSU Continuing Education, or any other MS certified training facility.
Also, right now MS is offering a free second shot exam if you register before end of June. For more info, see http://www.microsoft.com/learning/mcp/offers/2ndchance/.
A: Check out this link (http://www.microsoft.com/learning/mcp/mcsd/requirementsdotnet.asp). It lists the tests needed for passing the MCSD along with MS courses. You can register with these exact same course numbers at CCC or CSU Continuing Education, or any other MS certified training facility.
Also, right now MS is offering a free second shot exam if you register before end of June. For more info, see http://www.microsoft.com/learning/mcp/offers/2ndchance/.
Subscribe to:
Posts (Atom)