I have a class library with a class for authentication that uses forms
authentication.
The RedirectFromLoginPage class is called through my application using:
ClassLibrary.Authentication.FormsAuthentication.RedirectFromLoginPage(UserID,
False)
and, although this method works as intended, it leaves a warning (green
squiggly) which looks like I don't know what I'm talking about
(unprofessional). Here is the declaration:
Public Shared mFormsAuthentication As New
System.Web.Security.FormsAuthentication
Public Shared Property FormsAuthentication() As
System.Web.Security.FormsAuthentication
Get
Return mFormsAuthentication
End Get
Set(ByVal value As FormsAuthentication)
mFormsAuthentication = value
End Set
End Property
Can I resolve this? I tried using an assigned instance (objClassLibrary as
ClassLibrary), but reached a lot of errors all over the application when I
do that so I stick with this method instead.
Thanks in advance.
"Nick Large" wrote:
> Hello.
>
> I have a class library with a class for authentication that uses forms
> authentication.
>
> The RedirectFromLoginPage class is called through my application using:
>
> ClassLibrary.Authentication.FormsAuthentication.RedirectFromLoginPage(UserID,
> False)
>
> and, although this method works as intended, it leaves a warning (green
> squiggly) which looks like I don't know what I'm talking about
> (unprofessional). Here is the declaration:
>
Is the warning on the line above? If so, what is the declaration of
RedirectFromLoginPage()? You would get the warning if you tried to call a
shared method on an instance variable.
> Public Shared mFormsAuthentication As New
> System.Web.Security.FormsAuthentication
>
> Public Shared Property FormsAuthentication() As
> System.Web.Security.FormsAuthentication
>
> Get
>
> Return mFormsAuthentication
>
> End Get
>
> Set(ByVal value As FormsAuthentication)
>
> mFormsAuthentication = value
>
> End Set
>
> End Property
>
Those declarations don't seem to have any relationship to the question.
>
> Can I resolve this? I tried using an assigned instance (objClassLibrary as
> ClassLibrary), but reached a lot of errors all over the application when I
> do that so I stick with this method instead.
ClassLibrary "appears" to be a namespace in your application, not a class.
That is why you would get errors doing that.
>
> Thanks in advance.
>
Mike
The right MSDN managed newsgroup for ASP.NET issues is
public.dotnet.framework.aspnet. Would you mind reposting the questions
there. We will have ASP.NET dedicated engineer supports on this issue there.
Please let me know if there is anything else I can help! Have a nice day,
Sir!
Best regards,
Ji Zhou
Microsoft Online Community Support
> I have a class library with a class for authentication that uses forms
> authentication.
>
> The RedirectFromLoginPage class is called through my application
> using:
>
> ClassLibrary.Authentication.FormsAuthentication.RedirectFromLoginPage(U
> serID, False)
>
> and, although this method works as intended, it leaves a warning
> (green squiggly) which looks like I don't know what I'm talking about
> (unprofessional). Here is the declaration:
>
> Public Shared mFormsAuthentication As New
> System.Web.Security.FormsAuthentication
>
> Public Shared Property FormsAuthentication() As
> System.Web.Security.FormsAuthentication
Why are you setting up FormsAuthentication as Shared in your application?
The methods are already Shared in nature, so you are not saving anything
here, but you are likely setting yourself up for other problems.
You can access FormsAuthentication at any point in time without wrapping it
in a class as a Shared member.
Peace and Grace,
--
Gregory A. Beamer
Microsoft MVP (Visual C# Architecture)
Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com
**********************************************
| Think outside the box! |
**********************************************