Hi Alex:
For question 'a' - I'm not aware of a way to override the default.aspx
URL of RedirectFromLogin. Someone else might have an idea.
For question 'b' there is no quick and easy method to call,
unforunately, but you can use the DirectorySearcher class from
System.DirectoryServices to look up the user groups. For a sample, see
the code in the following article:
http://msdn.microsoft.com/library/de...m_asp__net.asp
--
Scott
http://www.OdeToCode.com/blogs/scott/
On Sat, 12 Feb 2005 02:13:43 -0500, "Alex Nitulescu"
<> wrote:
>Hi. I have two questions, please:
>
>a) If I go DIRECTLY to Login, there's no Request.Params("ReturnURL"), and
>therefore RedirectFromLogin won't work, because it will try to go to a page
>named "Default", which in my case does not exist. Short of creating a
>"mandatory" Default page, what can I do ? RedirectFromLogin not only
>redirects me to whereever I came from, but it also creates a ticket - so how
>can I still use it if the redirection part is not convenient in my case
>(there's no Default.aspx page) ?
>Should I check whether Request.Params("ReturnURL") is null, and in this case
>set it somehow to the page I want the user to go after login ?
>Request.Params("ReturnURL") is read-only !
>
>b) If a user has several roles, how can I list them all ? Now I have some
>ugly code like:
>
>If User.IsInRole("Admin") Then
> strRole &= "<li>Administrator"
>End If
>If User.IsInRole("Sales") Then
> strRole &= "<li>Sales"
>End If
>If User.IsInRole("Support") Then
> strRole &= "<li>Support"
>End If
>If User.IsInRole("Guest") Then
> strRole &= "<li>Guest"
>End If
>lblRole.Text = User.Identity.Name & ", your application role is: <h2>" &
>strRole & "</h2> !"
>
>I'm asking this because of course there are ways to go around this, but I
>wanted to encapsulate this "role" thing in global.asax in
>Application_AuthenticateRequest. I could read again somewhere in my
>application my "roles" XMLFile (or dbTable) and list all the roles for user
>X, maybe even without checking for "IsInRole", but I'm looking for an
>elegant, OO solution to this problem. Should I write a function which reads
>all the roles for user X in an array and put this function in a module and
>call it as well from Application_AuthenticateRequest as from wherever else I
>need to list the roles for a specific user ?
>
>Thank you for bearing with me.
>Alex.
>