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

  • SEARCH
  • Home
  • 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 7166759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:27:55+00:00 2026-05-28T14:27:55+00:00

I was reading about an example on Microsoft web site on how to show

  • 0

I was reading about an example on Microsoft web site on how to show or hide a “Register” link for an object depend on whether the current user is already registered or not.
They add the following code to the view to display the Register link only if the current user is not already registered:-

<div id=”rsvpmsg”>
<% if (Request.IsAuthenticated) { %>
<% if (Model.IsUserRegistered(Context.User.Identity.Name)) { %>
<p>You are registered for this event!</p>
<% } else { %>
<%: Ajax.ActionLink( “RSVP for this event”,
“Register”, “RSVP”,
new { id=Model.DinnerID },
new AjaxOptions { UpdateTargetId=”rsvpmsg” }) %>

then on the register action method they also perform the same check to check if the user is already registered or not as follow:-

    [Authorize, HttpPost]
    public ActionResult Register(int id) {
    Dinner dinner = dinnerRepository.GetDinner(id);
    if (!dinner.IsUserRegistered(User.Identity.Name)) {
    RSVP rsvp = new 

RSVP();
// .....

So my question is why they perform the same check on the Post action method again,,, is there a chance for a user to call the POST register action method other than clicking on the Register link that will not be displayed if the user is already register ? … so why not to consider the

 if (!dinner.IsUserRegistered(User.Identity.Name)) 

check on the action method as unnecessary ?
BR

  • 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-28T14:27:55+00:00Added an answer on May 28, 2026 at 2:27 pm

    Yes, it’s decidedly possible, and very easy.

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

Sidebar

Related Questions

After reading the MSDN article about proper user interface here: http://msdn.microsoft.com/en-us/library/aa974176.aspx I want to
I started reading about struts2 yesterday and came across the below slide. Site link
I've just been reading about REST URLs and seen the following example: /API/User/GetUser Now
While reading a book about JavaScript I stumbled across an example: var names =
I was reading about SIOF from a book and it gave an example :
i'm reading a book about Qt, there is an example about how to pop
When reading about SQL I've come across the term 'slot'. For example, in a
while reading about declare construct from php manual i tried the following example using
I was reading about SSI here . The first code example under the section
Reading about TFS' MSF for Agile Software Development v5.0 template ( for example here

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.