Re: Translating VB.NET-code into C#.NET + ASP.NET

From: Sjakie (Sjakie_at_discussions.microsoft.com)
Date: 08/09/04


Date: Mon, 9 Aug 2004 03:55:01 -0700

This is the only error I get:
       Cannot implicitly convert type 'System.Array' to 'string[]'
       
       on line --> string[] roleListArray =
roleList.ToArray(typeof(string)); <--

"Mike Bright MSP" wrote:

> Sjakie, don't have a compiler to hand to check this but:
>
> protected void Application_AuthenticateRequest(Object sender, EventArgs e)
> {
> if(Request.IsAuthenticated)
> {
> SqlDataReader reader;
>
> reader =
> SqlHelper.ExecuteReader(connection_string,CommandType.StoredProcedure,"rolesForUser",new
> SqlParameter("@Username",User.Identity.Name));
>
> ArrayList roleList = new ArrayList();
>
> while(reader.Read())
> {
> roleList.Add(reader["Name"]);
> }
>
> string[] roleListArray = roleList.ToArray(typeof(string));
>
> HttpContext.Current.User = new
> GenericPrincipal(User.Identity,roleListArray);
> }
>
> }
>
> Mmm, as I said no compiler to hand, so if it doesnt compile post back, b.t.w
> this isn't really the place to post this, you should post this in the
> C# newsgroups.
>
> Regards
>
> Mike Bright MCP, MSP
>
> e:mike.bright@brightweb.co.uk
>
>
>



Relevant Pages

  • Re: Encrypting files and folders
    ... Do they delight in putting something in a software version, knowing that ... "Mike Bright MSP" wrote in message ... > Sorry but the EFS system is not supported in Windows XP Home Edition, ...
    (microsoft.public.windowsxp.security_admin)
  • RE: Firewall detection
    ... "Mike Bright MSP" wrote: ... > Unfortunatly there isn't a specific key in the registry ... > which will indicate whether the Firewall is on or off. ...
    (microsoft.public.windowsxp.security_admin)
  • RE: Managing user account FOLDERS
    ... Kim Schmidt KS6P ... "Mike Bright MSP" wrote: ... > Mike Bright MCP, MSP ...
    (microsoft.public.windowsxp.security_admin)
  • Re: WSEM300.DLL??
    ... System Suite virus scanner picked it up...also ran computer through the ... Trends online virus scaner Housecall which didnt pick it up...Thanks for your ... "Mike Bright MSP" wrote: ...
    (microsoft.public.windowsxp.security_admin)
  • RE: pc scillian & zone.msn.com
    ... "Mike Bright MSP" wrote: ... > Cillin" the update process is probably being blocked by ... > overview of the Windows Firewall and how you might go ...
    (microsoft.public.windowsxp.security_admin)