Why does @ Html.AntiForgeryToken () return null?
I have configured my asp.net mvc application in iis on our server. after starting the application, the exception occurs as follows:
Object reference not set to an instance of an object.
Line 10: {
Line 11: <div class="form-horizontal">
Line 12: @Html.AntiForgeryToken() <-- here
I checked the MachineKey (in the web.config file) of the application in iis, which:
<machineKey decryptionKey="AutoGenerate,IsolateApps" validation="SHA1" validationKey="AutoGenerate,IsolateApps" />
I can't figure out what the problem is!
Update:
also, I checked the session, but it is not null. I got Session.SessionID
in the razor and I got the actual value ( hutqqygxwbvvwaerztvamf1n
).
+3
source to share
No one has answered this question yet
Check out similar questions: