question

mush-9787 avatar image
0 Votes"
mush-9787 asked ianchen answered

ASP.NET: Imports System.Security.Cryptography is not working

I'm working in a project where i need to use the Imports System.Security.Cryptography , however, whenever I log in into the system it gives me this error:

 System.NullReferenceException: 'Object reference not set to an instance of an object.'
    
 strText was Nothing.


anyone know what is the reason?


[1]: /answers/storage/attachments/202174-capture3.png

dotnet-aspnet-core-general
capture3.png (14.8 KiB)
capture3.png (14.8 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

If you try to access a member of a class instance using a null reference then you get a System.NullReferenceException.

Check your code which line of code will show this exception, and where you defined or create the strText instance?

0 Votes 0 ·

this one:202236-webpnet-compress-image.jpg


0 Votes 0 ·
ZhiLv-MSFT avatar image
0 Votes"
ZhiLv-MSFT answered ZhiLv-MSFT edited

Hi @mush-9787,

As the error message said, the strText is nothing. Before getting the strText length , you'd better add an IF statement to check whether the strText is nothing or null. Then, if the strText is not nothing, you can get the length.


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Best regards,
Dillion

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ianchen avatar image
0 Votes"
ianchen answered

you must check strText instance is null or not

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.