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 7678933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:45:36+00:00 2026-05-31T17:45:36+00:00

I have an action method VerifyNewUser() that gets called when the user clicks a

  • 0

I have an action method VerifyNewUser() that gets called when the user clicks a url in their email (registration verification url).

The action method sets a bool property in the ViewBag, updates the user to a verified user, then I load the home page with the user automatically signed in. In the /Home/Index view I want to check the ViewBag for the property I set and display a jquery ui dialog if its true.

However, my ViewBag is null and the script gets skipped. Note I store the message in the homeController.ViewBag so I thought this would work. Perhaps theres a better way to do it this without a ViewBag?

public ActionResult VerifyNewUser()
    {
        if(everything checks out)  
        {
              HomeController homeController = new HomeController();
              homeController.ViewBag.RegisterationLoad = true;
              homeController.ViewBag.VerificationMessage = "Thank you! Your account has been activated";
              return View("../Home/Index", null);
        }
    }

nothing special in Home controller:

    public ActionResult Index(){ 
        return View();
    }

In the home view i have this code thats supposed to checks if the homepage is being loaded after clicking the verification url and should display a jquery ui dialog:

   @if (ViewBag.RegistrationLoad == "true")
   {
<script type="text/javascript">
    $("<div></div>").html("<span>@ViewBag.VerificationMessage</span>").dialog({
        width: 365, height: 165, minWidth: 365, minHeight: 165, maxWidth: 365, maxHeight: 165,
        autoOpen: true, modal: true, dialogClass: 'noTitleDialog', position: "center",
        buttons: {
            "Ok": function () {
                $(this).remove();
            }
        }
    });
</script>   
   }

Thanks for your time

  • 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-31T17:45:37+00:00Added an answer on May 31, 2026 at 5:45 pm

    Don’t use any controller to set the data attributes inside ViewBag. Just set it normally and it can be accessible inside any view. Just make sure you use it correctly. In your code you are setting a boolean flag inside ViewBag and you are comparing it against a string which will always fail.

    Try this.

    public ActionResult VerifyNewUser()
    {
        if(everything checks out)  
        {
              ViewBag.RegisterationLoad = true;
              ViewBag.VerificationMessage = "Thank you! Your account has been activated";
              return View("../Home/Index", null);
        }
    }
    

    In the view

       @if (ViewBag.RegistrationLoad == true)
       { 
            .....
            .....
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an action method that depending on some conditions needs to return a
I have an action method that takes in two different objects. I am posting
I have an ASP.NET MVC project with a form. In the Action method that
I have an Action Method that I'd either like to return JSON from on
Is it possible to have a action method with a name that is different
I have an Action that requires authentication. The action method creates some records with
I'm testing Play! on Windows and Ubuntu. I have an action method that accepts
I have an action-method in a controller that takes requests coming from a variety
I have an Action Method that returns a JSON-serialized object. The problem I'm having
I have an action method that looks like this: public ActionResult Index(string message) {

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.