RedirectFromLoginPage warning message

N

Nick Large

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:

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.
 
T

Thomas Sun [MSFT]

Hi Nick,

To better understand the issue, could you please post the warning message
here?

You can put the cursor hovers on that "green squiggly" and then the warning
message will appear. Or you can build your project and see the Warning tab
of Error List window.


I look forward to hearing from you.


Best Regards,
Thomas Sun

Microsoft Online Partner Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
T

Thomas Sun [MSFT]

Hi Nick,

I haven't heard back from you yet and I'm just writing in to see if you
have had an opportunity to collect the information. If you could get back
to me at your earliest convenience, we will be able to go ahead. If there
was some part of my post that you didn't understand, please feel free to
post here.

I look forward to hearing from you.


Best Regards,
Thomas Sun

Microsoft Online Partner Support

This posting is provided "AS IS" with no warranties, and confers no rights.
-------------------
|
| Hi Nick,
|
| To better understand the issue, could you please post the warning message
| here?
|
| You can put the cursor hovers on that "green squiggly" and then the
warning
| message will appear. Or you can build your project and see the Warning
tab
| of Error List window.
|
|
| I look forward to hearing from you.
|
|
| Best Regards,
| Thomas Sun
|
| Microsoft Online Partner Support
|
| ==================================================
| Get notification to my posts through email? Please refer to
|
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
| ications.
|
| With newsgroups, MSDN subscribers enjoy unlimited, free support as
opposed
| to the limited number of phone-based technical support incidents. Complex
| issues or server-down situations are not recommended for the newsgroups.
| Issues of this nature are best handled working with a Microsoft Support
| Engineer using one of your phone-based incidents.
| ==================================================
|
| This posting is provided "AS IS" with no warranties, and confers no
rights.
|
|
 
N

Nick Large

Sorry Thomas,

The warning is:

Access of shared member, constant member, enum member or nested type through
an instance; qualifying expression will not be evaluated

This essentially indicates that, if I create an instance of a variable of
type FormsAuthentication and access this through the object, that the
expression will not be evaluated. It is evaluated so this makes no sense
that it would not. Here is an example of the code I use:

MyClassLibrary.Authentication.FormsAuthentication.RedirectFromLoginPage(UserID,
False)

Thank you again, in advance,
Nick.
 
T

Thomas Sun [MSFT]

Hi Nick,

Thanks for your response.

The warning message is helpful and it indicates that you tried to call a
shared method from a specific instance of a class. The shared method is
part of a class but is not specific to any one instance of a class, so you
got the warning message.

To resolve it, you can call this shared method using Class name directly.
For example, the follow is a class named "TestSharedClass" with a shared
method "DoSomething":
=========================
Imports Microsoft.VisualBasic

Public Class TestSharedClass
Public Sub New()
End Sub

Public Shared Sub DoSomething()

End Sub
End Class
=========================

We can call this shared method by following:
=========================
TestSharedClass.DoSomething()
=========================

For more information about Shared Members in Visual Basic, you can refer to
http://msdn.microsoft.com/en-us/library/4hbsxy95(VS.80).aspx


I look forward to receiving your test results.



Best Regards,
Thomas Sun

Microsoft Online Partner Support

--------------------
| From: "Nick Large" <[email protected]>
| Sorry Thomas,
|
| The warning is:
|
| Access of shared member, constant member, enum member or nested type
through
| an instance; qualifying expression will not be evaluated
|
| This essentially indicates that, if I create an instance of a variable of
| type FormsAuthentication and access this through the object, that the
| expression will not be evaluated. It is evaluated so this makes no sense
| that it would not. Here is an example of the code I use:
|
|
MyClassLibrary.Authentication.FormsAuthentication.RedirectFromLoginPage(User
ID,
| False)
|
| Thank you again, in advance,
| Nick.
|
| | > Hi Nick,
| >
| > I haven't heard back from you yet and I'm just writing in to see if you
| > have had an opportunity to collect the information. If you could get
back
| > to me at your earliest convenience, we will be able to go ahead. If
there
| > was some part of my post that you didn't understand, please feel free to
| > post here.
| >
| > I look forward to hearing from you.
| >
| >
| > Best Regards,
| > Thomas Sun
| >
| > Microsoft Online Partner Support
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| > rights.
| > -------------------
| > |
| > | Hi Nick,
| > |
| > | To better understand the issue, could you please post the warning
| > message
| > | here?
| > |
| > | You can put the cursor hovers on that "green squiggly" and then the
| > warning
| > | message will appear. Or you can build your project and see the Warning
| > tab
| > | of Error List window.
| > |
| > |
| > | I look forward to hearing from you.
| > |
| > |
| > | Best Regards,
| > | Thomas Sun
| > |
| > | Microsoft Online Partner Support
| > |
| > | ==================================================
| > | Get notification to my posts through email? Please refer to
| > |
| >
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
| > | ications.
| > |
| > | With newsgroups, MSDN subscribers enjoy unlimited, free support as
| > opposed
| > | to the limited number of phone-based technical support incidents.
| > Complex
| > | issues or server-down situations are not recommended for the
newsgroups.
| > | Issues of this nature are best handled working with a Microsoft
Support
| > | Engineer using one of your phone-based incidents.
| > | ==================================================
| > |
| > | This posting is provided "AS IS" with no warranties, and confers no
| > rights.
| > |
| > |
| >
|
|
|
 
T

Thomas Sun [MSFT]

Hi Nick,

I would like to follow up on this issue and see if any progress has been
made. I haven't heard from you in 2 days, were you able to check my reply?
Should you have any questions, please feel free to post here.

Looking forward to your reply!


Best Regards,
Thomas Sun

Microsoft Online Partner Support

--------------------

|
| Hi Nick,
|
| Thanks for your response.
|
| The warning message is helpful and it indicates that you tried to call a
| shared method from a specific instance of a class. The shared method is
| part of a class but is not specific to any one instance of a class, so
you
| got the warning message.
|
| To resolve it, you can call this shared method using Class name directly.
| For example, the follow is a class named "TestSharedClass" with a shared
| method "DoSomething":
| =========================
| Imports Microsoft.VisualBasic
|
| Public Class TestSharedClass
| Public Sub New()
| End Sub
|
| Public Shared Sub DoSomething()
|
| End Sub
| End Class
| =========================
|
| We can call this shared method by following:
| =========================
| TestSharedClass.DoSomething()
| =========================
|
| For more information about Shared Members in Visual Basic, you can refer
to
| http://msdn.microsoft.com/en-us/library/4hbsxy95(VS.80).aspx
|
|
| I look forward to receiving your test results.
|
|
|
| Best Regards,
| Thomas Sun
|
| Microsoft Online Partner Support
|
| --------------------
| | From: "Nick Large" <[email protected]>
| | Sorry Thomas,
| |
| | The warning is:
| |
| | Access of shared member, constant member, enum member or nested type
| through
| | an instance; qualifying expression will not be evaluated
| |
| | This essentially indicates that, if I create an instance of a variable
of
| | type FormsAuthentication and access this through the object, that the
| | expression will not be evaluated. It is evaluated so this makes no
sense
| | that it would not. Here is an example of the code I use:
| |
| |
|
MyClassLibrary.Authentication.FormsAuthentication.RedirectFromLoginPage(User
| ID,
| | False)
| |
| | Thank you again, in advance,
| | Nick.
| |
| | | | > Hi Nick,
| | >
| | > I haven't heard back from you yet and I'm just writing in to see if
you
| | > have had an opportunity to collect the information. If you could get
| back
| | > to me at your earliest convenience, we will be able to go ahead. If
| there
| | > was some part of my post that you didn't understand, please feel free
to
| | > post here.
| | >
| | > I look forward to hearing from you.
| | >
| | >
| | > Best Regards,
| | > Thomas Sun
| | >
| | > Microsoft Online Partner Support
| | >
| | > This posting is provided "AS IS" with no warranties, and confers no
| | > rights.
| | > -------------------
| | > |
| | > | Hi Nick,
| | > |
| | > | To better understand the issue, could you please post the warning
| | > message
| | > | here?
| | > |
| | > | You can put the cursor hovers on that "green squiggly" and then the
| | > warning
| | > | message will appear. Or you can build your project and see the
Warning
| | > tab
| | > | of Error List window.
| | > |
| | > |
| | > | I look forward to hearing from you.
| | > |
| | > |
| | > | Best Regards,
| | > | Thomas Sun
| | > |
| | > | Microsoft Online Partner Support
| | > |
| | > | ==================================================
| | > | Get notification to my posts through email? Please refer to
| | > |
| | >
|
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
| | > | ications.
| | > |
| | > | With newsgroups, MSDN subscribers enjoy unlimited, free support as
| | > opposed
| | > | to the limited number of phone-based technical support incidents.
| | > Complex
| | > | issues or server-down situations are not recommended for the
| newsgroups.
| | > | Issues of this nature are best handled working with a Microsoft
| Support
| | > | Engineer using one of your phone-based incidents.
| | > | ==================================================
| | > |
| | > | This posting is provided "AS IS" with no warranties, and confers no
| | > rights.
| | > |
| | > |
| | >
| |
| |
| |
|
|
|
 
N

Nick Large

Thomas

That worked! I didnt think about that, good explanation, thanks.

So, to recap, I had:

MyClassLibrary.Authentication. _
FormsAuthentication.RedirectFromLoginPage

which gave me the error. When I remmed-out the first line so that it only
included the second half of the
statement, then the warning went, because I was severring it from my class
implementation. It now looks like:

'MyClassLibrary.Authentication _
FormsAuthentication.RedirectFromLoginPage

which resolves to:

FormsAuthentication.RedirectFromLoginPage

Thanks again.
Nick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top