.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

GetPermissionCollection, Converting Permission Mask to Roles

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :SharePoint


Hi, I'm retrieving permissions on a list of files using SharePoint's Permission Web Service and the GetPermissionCollection method. I'm able to retrieve the Permissions, but i'd like to be able to convert the permission mask into the role(s) it belongs to. (just like if you view the Permissions through the web site).


Is there a straight forward way to do this through Share Points Web Services?


For example:

 GetPermissionCollection may give me the following Permission

<Permission MemberID="6" Mask="134287360" MemberIsUser="False" MemberGlobal="True" GroupName="Style Resource Readers" />


Looking at the Permissions on the file though the Web I see that Style Resource Readers have the "Limited Access" Role on that file.


Any help on this would be greatly appreciated

View Complete Post

More Related Resource Links

ASP.NET forms authentication with roles

.A timeout is specified in minutes. This is "time since last request" not the "time since login". If a login is indicated to be persistent (described later) this is ignored.
.A protection method is specified for the cookie.
Next I wanted to specify a folder to which access is restricted to people who have logged in. To do this I entered the following code in the web.config file (beneath

WebMatrix conversion failed when converting from a character string to uniqueidentifier?


I am trying to retrieve xml from a small function in my .cshtml page. Its throwing me an error. This however, runs fine in a console/form environment.

It takes 3 parameters and 1 exception.

myDll.GetXML(year, username, uniqueidentifier, out ex);

When I run this page I get the error, "Conversion failed when converting from a character string to uniqueidentifier."

Or a stack of.

System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting from a character string to uniqueidentifier.

   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()

   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()

   at System.Data.SqlClient.SqlDataReader.get_MetaData()

   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBeha

Hard Code Roles on the Pages


If i hard coded role=Manager on the specific SiteMap/Folder/Page/etc. I will have problem when the manager need to remove from access a specific page. I need to change the code ont eh page/SiteMap/Folder more move the file into another folder.

What i have in mind is to change the role to taks oriented. such as role=AddStock, Edit Stock, Delete Stock, Print DO, Add Sales, Edit Sales, Deleted Sales..... (but it will be many role for 1 user compare to just 1 as Manager)

Will this cause performance issues later when each user have 60 roles and if i have 20,000 user will it affect the application performance?

Otherwise any other option? to make it flexible.

System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPerm


Good Day all,

Having an issue with an outside user accessing my IIS7 box. I do not have this problem when running the website from my host machine. I found this post: Http://forums.asp.net/t/1371394.aspx. I assure you that this is not a solution because I am not storing any of my files on a network share. 

What do you think my approach should be. 

I already have read rights to IIS user to my BIN folder. 

Thanks for the help. 

Converting ReportDocument object into byte array ?


Hi All,

          Is it possible to convert the Report Document object as a byte array and store it in SQL , later retrieve and assing it to a report ?


Problems converting VS 2003 project to VS 2008



I'm having problems converting a VS 2003 project to VS 2008 (tried 2005 as well, same problem). There are several problems;
a) I don't have VS 2003 installed.
b) The project is a web service, however I'm not sure what type of VS project it was created as.
c) The general knowledge about the project setup is..slim.

I get a error message using the conversion wizard, however, I'm not familiar with the tool and I cannot quite find any good information on Google for it, so I am left with a error message I do not understand.

Conversion Issues - myProject.csproj:
Unable to open the Web site 'C:\local\path\to\project\myProject.csproj'. The Web site 'C:\local\path\to\project\myProject.csproj' does not exist.

The web service is not intended to run on the dev machine, it is copied to a test or a prod server. However, I do not know how this was done previously. I'm thinking that in order to convert, it has to access the server on which it should run (which is set somehow in a config maybe). But that doesn't actually make any sence..

If anyone could shed light on this, I would really appreciate it.

Thank you.

Converting Time formats


Hi guys,

So ive been converting an asp website to asp.net. What i did was run the migration wizard in the old VS2003, then when importing it bk into vs2008, i belive it upgraded it agin. I have been plodding along correcting basic erros and have come stuck with this one. Originallany the site has two input types, one for date and one for time. the new script is below with error im getting. I manged to get the date correct but the time is more tricky. Any suggestions would be appreciated.



Date = FormatdateTime(IIF(IsDBNull(MyRs1.Fields.Item("").Value), Nothing, MyRs1.Fields.Item("").Value), DateFormat.ShortDate)

Time = FormatdateTime(IIF(IsDBNull(MyRs1.Fields.Item("").Value), Nothing, MyRs1.Fields.Item("").Value), DateFormat.ShortTime)


Exception Details: System.InvalidCastException: Conversion from type 'Double' to type 'Date' is not valid.

Source Error:

Line 74: 
Line 75: 'TODO Need to correct the format 
Line 76:   Time= FormatDateTime(IIf(IsDBNull(MyRs1.Fields.Item("").Value), Nothing, MyR

Help converting vbscript to vb.net


Can anyone help me convert the below vbscript to vb.net:


On Error Resume Next

Dim sRunTime,sSitupCount,sPushupCount,sRunMin,sRunSec,sRunScore,sCompScore,sBodyComp
Dim iCompositeScore

Set oRE = New RegExp

sRunTime = InputBox("Enter your run time")
oRE.Pattern = "[0-5][0-9]:[0-5][0-9]"

If oRE.Test(sRunTime) = True Then
 WScript.Echo "Pattern Match"
 MsgBox "You must enter a valid run time in the following format: ""mm:ss""." & vbCr & "Please run the application again."
End If

sRunMin = Left(sRunTime,InStr(sRunTime,":")-1)
sRunSec = Right(sRunTime,InStr(sRunTime,":")-1)

sBodyComp = InputBox("Enter your waiste measurement")
oRE.Pattern = "[2-6][0-9].[0,5]"

If Len(sBodyComp) = 2 Then
 sBodyComp = sBodyComp + ".0"
End If

If oRE.Test(sBodyComp) = True Then
 WScript.Echo "Pattern Match"
 MsgBox "You must enter a waiste measurement in the following format: ""nn.n""." & vbCr & "Please run the application again."
End If

sSitupCount = InputBox

Converting from PHP to ASP


Dear all friends

 Hi to you all. I am now looking for not only your help but als your advices and suggestions to my situation.

here is the url of my current running PHP server http://www.yarnxchange.com/index.php

FIrst things I wish to know is which asp controls can replace the current PHP ones to act the same way

1.  In the top of the page the Latest news (News Ticker).

2. Under the banner logo the black line has a streamer that read data from database and view them in sme way like marquee and when roll over it stops and when click i can go to the details page.

3. In the bottom page The Yarn offers section . it shows data from mutiple tables but in the same place when click each item it displays the rows of its table in the right section . I think that there is a way or a data controller that can act the same way I wish your advice.

For sure after that I wish to know your ideas , recommendations and advices to make the full conversion in the best way

C# to VB: Converting to Boolean


I am converting some C# code to VB, the following code is part of a function

if (bool.Parse(v["Parent"].ToString()))
e.Row.CssClass = "Parent";

V is System.Data.DataRowView When I convert this to.

If Boolean.Parse(v("Parent").ToString()) Then
	e.Row.CssClass = "Parent"
End If

The code throws an error "String was not recognized as a valid Boolean" But if I use this code

If CBool(v("Parent").ToString) = True Then
e.Row.CssClass = "Parent"
End If

It works fine, which is great, I am just curious why?

Converting Crystal Report 2005 to 2008 - Please Tell Me I'm Stupid :)


Hello peeps,

  I have a series of Crystal Reports that I can view/edit using Visual Studio 2005 with no issues.  The method I'm using is to simply click on the *.rpt file and it opens in the VS crystal editor with no issues.  The problem I'm having is that we are upgrading to Visual Studio 2008, and when I open the *.rpt file in 2008 it opens as a binary file.  I guess I'm used to everything else in Visual Studio prompting me to convert the older version to the newer version, so I'm not sure what to do in this case.

  Is this normal?  Is there an easy conversion method that I'm simply overlooking?  Am I screwed?  Who invented liquid soap, and why?

Answers to any of these questions would be greatly appreciated...

How in web.config work in MVC



I would like to secure any URL below the http://MyServer/Admins and limit it to a specific role.

In webforms it was straight forward. I just put a child web.config in the /Admin/ folder and add <authorization>  <allow roles> tags to it.

How would be the equivalent technique in MVC?

Thank you,


Roles not updating


I have all my code in my other post about checkboxlist issue, but it boils down to, once i find someone doing my search, it displays their permissions as checkboxes. But if i want to remove a permission and click update, the update doesnt seem to occur, if i search on myself, it returns me with my permissions already checked. I uncheck 1 permission, click update and the checkbox is checked again as the page posts.

Original Post:

My aspx page seems pretty simple:

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>Enter UserName: 
        <asp:TextBox ID="TxtUserName" runat="server" /><asp:Button ID="LookupBtn" runat="server" Text="Search" onclick="LookupBtn_Click" />  
    <div class="roleList">
        <asp:CheckBoxList ID="RoleList" runat="server" /><br />
        <asp:button ID="UpdateBtn" text="Update" Visible="false" runat="server" onclick="UpdateBtn_Click" />

My update button event and update method:

Trying to get Roles to populate a checkboxlist based on tutorial and having issues.


I have been using the following tutorial and had to convert the code to C# for my project, now i cant get the code to work, im getting red line under the word "in" in the UpdateRolesFromList,
i tried to add a datasource on page load for the checkboxlist like so RoleList.DataSource = PopulateRoleList(User.Identity.Name.ToString());

and gives me error saying cannot implictly convert type 'void' to 'object'


What am i missing, that when i load the page or even do a search it never displays the checkbox list as it shows in the tutorial?

        protected void Page_Load(object sender, EventArgs e)

        public void PopulateRoleList(string userName)
            string[] roleNames = null;
            string roleName = null;
            roleNames = Roles.GetAllRoles();
            foreach (string roleName_loopVariable in roleNames)
                roleName = r

How to stop the repeated database queries for roles


Hello, friends,

We have a web application using VS 2008, c#. We try to filter siteMap nodes based on security roles. We have our customized the mether GetRolesForUser() in RoleProvider class to determine a user's role. In this method, roles will be returned by querying an SQL Server database.

However, we found that each time a page was loaded/refershed, this  GetRolesForUser() was called, and the database would be queried. This is too MUCH and expensive.

We thought the roles should be queried only once when a user logs in. After that, role info should be stored somewhere for this user, rather than query DB all the time.

Any ideas, reference paper, snipet,...,?

Thanks a lot!

Error converting data type varchar to numeric.


I create a form to record data using ASP.NET and SQL database...
when i run the project show error "Error converting data type varchar to numeric"

what's the problem actually.i try to change in datatype in database..
but still showing error...


Error "user does not have permission to perform this operation" with User Instance = True.


I setup SQL Server 2005 / SQL Express. All works fine in SQL Server 2005.

I am connecting to a SQL Database from VS 2005,  Tools/Connect to Database. I set the Data Source to "Microsoft SQL Server Database File (SqlClient)" (meaning SQL Server Express) and User Instance = True, and Integrated Security = True.

The above is working successfully on all machines except my Laptop. On my Laptop, I am getting this error "user does not have permission to perform this operation". On my Laptop, if I change User Instance = False, it works fine. Also, If I connect to SQL Server 2005 it works fine only if User Instance = False.

I tried all kind of security changes, nothing worked. For example, I setup Everyone as Full Control for the Folder and the MDF File of SQL Server. I gave my user ID as sysadmin role in SQL Server Express. Also, I enabled creating User Instance form SQL Server Express, Nothing is working.

Appreciate your help.


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend