Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4534458
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:17:00+00:00 2026-05-21T14:17:00+00:00

Is there a way to check this? I’m using the .NET framework and want

  • 0

Is there a way to check this? I’m using the .NET framework and want to understand more on how to protect from CSRF attacks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T14:17:00+00:00Added an answer on May 21, 2026 at 2:17 pm

    Referrer checking alone won’t help you and it can bother users, so it’s better not to rely on it.

    ASP.NET can help you mitigate CSRFs through the viewstate: every postback must include the viewstate, otherwise the framework will raise an exception, and since an attacker can’t read it (to read the viewstate he must fetch the page, and cross site AJAX requests are not allowed) the attack will fail.

    However, as V4Vendetta pointed out the viewstate alone is not enough: if the page does not contain controls with unique-per-user content the viewstate will be the same for different user, so the attacker can simply submit his viewstate.

    To prevent this you can place this code in every page you want to protect:

    protected void Page_Init(Object sender, EventArgs e)
    {
        this.ViewStateUserKey = this.Session.SessionID;
    }
    

    Setting the Page.ViewStateUserKey will create a unique viewstate for every user, defeating the copy/paste. Or you can use a dedicated module like this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to check/test the type of a variable? I want to
hi friends Is there way to check wordpress logs? Like what actions admin has
This morning I moved a .NET website from our local server to live (not
Check this example: $('button').bind('click focus', function() { // Did I click or focus? });
I've got this code below, where I spawn several threads, normally about 7, and
I work on MVC.net application. I make asynch requests to my controller via jQuery.
I am working on a small text replacement application that basically lets the user
When a user chooses File > Print on a browser such as Firefox or
I just added a ScrollViewer to my WPF app. Now some of my content
I have to analyze a lot of XML files in my current project. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.