| |

VerySource

 Forgot password?
 Register
Search
View: 638|Reply: 4

With Forms authentication, I can't log in anymore! !! Help! !!

[Copy link]

2

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 Invalid IP Address

Post time: 2020-1-5 13:50:01
| Show all posts |Read mode
login.aspx.cs
Inside is:
FormsAuthentication.SetAuthCookie (sUserId, Cookie.Checked);

Some other pages are judged above
 if (HttpContext.Current.User.Identity.IsAuthenticated)
     {
      }

Login, if (HttpContext.Current.User.Identity.IsAuthenticated) on other pages
Is always false,

What's going on? ? ? ? Help! !! !! !! !!



Attached:

<system.web>
       <hostingEnvironment idleTimeout = "20" shutdownTimeout = "30" />
       <globalization requestEncoding = "gb2312" responseEncoding = "gb2312" />
       <customErrors mode = "Off" defaultRedirect = "/ Error.html" />
       
       <authentication mode = "Forms">
     <forms loginUrl = "/ Login.aspx" defaultUrl = "/ Default.aspx" name = "UserCookie" protection = "All" timeout = "40" path = "/" />
   </ authentication>
   
         
   </system.web>
Reply

Use magic Report

0

Threads

21

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 Invalid IP Address

Post time: 2020-1-6 10:27:01
| Show all posts
If you are using forms authentication, I don't see some users you added in web.config
Also, if you have many pages that require authentication to access, it is recommended to create a folder, put all protected pages, and set <deny user = "?" /> <Allow in this folder in web.config user = "*" />
This way you don't have to judge every page
Reply

Use magic Report

0

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-6 10:36:01
| Show all posts
just a example:

  if ((UserEmail.Text == "jchen@contoso.com")&&
            (UserPass.Text == "37Yj * 99Ps"))
      {
          FormsAuthentication.RedirectFromLoginPage
             (UserEmail.Text, Persist.Checked);
      }
      else
      {
          Msg.Text = "Invalid credentials. Please try again.";
      }
  }
Reply

Use magic Report

2

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 Invalid IP Address

 Author| Post time: 2020-1-6 17:54:01
| Show all posts
Users are stored in the database. . . .


if (HttpContext.Current.User.Identity.IsAuthenticated)
     {
      }

This sentence was written when a button was clicked,
Not page limited. . . . .


Super depressed! !!
Reply

Use magic Report

2

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 Invalid IP Address

 Author| Post time: 2020-2-12 11:45:01
| Show all posts
Help! !! !! !! Everyone! !! !!
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list