SPContext. Current. Web. CurrentUser is null

Source: Internet
Author: User

Record the problem.

 

Problem description:

The website verifies the form and enables anonymity.

User A has never logged on to the website or configured any permissions for user A on the website. That is to say, if you do not enable Anonymous Access, A has no right to access the website.

Then, use A to log on to the website (anonymous access is enabled), and SPContext. Current. Web. CurrentUser will be null.

 

Solution:

Add User A or all authenticated users to the visitor group, or assign other permissions to user.

After the configuration is complete, log on with A again, And SPContext. Current. Web. CurrentUser will be able to work normally.

 

Cause:

If a user has not been assigned any permissions, the first time the user logs on to an anonymous website, the Sharepint does not register the user, but is processed as an anonymous user.

This will cause the above situation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.