imports

  • Thread starter Thread starter Brian Shannon
  • Start date Start date
B

Brian Shannon

I am playing with Forms Authentication and I have the following imports
statement at the top.

Imports System.Web.Security

Now when I use
FormsAuthentication.RedirectFromLoginPage(foo) then I get squiggly's from
the GUI saying RedirectFromLoginPage is not a member of FormsAuthentication.

If I attach System.Web.Security to FormsAuthentication all is fine.

Why is this? I have expierenced this in the past with the System.IO
namespace. Where sometimes I needed to fully qualify the name even if I had
an Imports statement.

Thanks
 
And your page class's (page's) name doesn't happen to be
FormsAuthentication? This could be if two class names in same scope collide
when fully-qualified name is needed to identify them.
 
No, I created a new project to play with forms authentication. I only have
two pages: Login.aspx and PublicPage.aspx.

I copied the code out of ASP.NET unleashed. The books code doesn't fully
qualify the class name.

Thanks
 
No, I created a new project to play with forms authentication. I only
have
two pages: Login.aspx and PublicPage.aspx.

I copied the code out of ASP.NET unleashed. The books code doesn't fully
qualify the class name.

Thanks
Have you tried right clicking on FormsAuthentication in your code, then Go
to Definition? This should take you to the object browser where you can
check what namespace it's pulling from and if that method is there. Which
it should be, of course...
 
I tried your solution by going to the object browser and found that it is
pulling from my imported namesapce system.web.secutity.

Thanks anyways for your recommendation.
 
I tried your solution by going to the object browser and found that it is
pulling from my imported namesapce system.web.secutity.

Thanks anyways for your recommendation.

Craig Deelsnyder said:
Have you tried right clicking on FormsAuthentication in your code, then
Go
to Definition? This should take you to the object browser where you can
check what namespace it's pulling from and if that method is there.
Which
it should be, of course...

And the method was listed there, I assume?

OK, is it not compiling? Or just getting squigglies but will compile?
There's an option in Tools->Option->Text Editor->All Languages (General).
Try unchecking Hide advanced members. This does what it says and
sometimes can be confusing as the code still compiles.

My last ditch effort :-)
 
Thanks Craig for you help but the code will not compile unless I fully
qualify the namespace. If it's not fully qualified I get a message saying
RedirectFrom LoginPage is not a member of FormsAuthentication.

Thanks
 
Back
Top