Get grecaptcha in knockout viewmodel asp.net mvc umbraco - asp.net

I am trying to use google's recaptcha in my web site(Umbraco). The problem I am facing is that I can not use grecaptcha in my viewmodel.
So far, I have included into my _Layout.cshtml
<script src='https://www.google.com/recaptcha/api.js'></script>
But when I try to access grecaptcha in view model I get
cannot resolve symbol grecaptcha
error.
So I can't do any of actions related to captcha.

I ended up with grecapctha.reset() on view, not viemodel

Related

SignalR issues with existing website

When I am trying to add SignalR in our existing web application (with MVC 4) I am getting below error message on page load.
Message: Unable to get value of the property 'signalR': object is null or undefined
URI: http://dev.casino.bwin.com/signalr/hubs
I tried to navigate to signalr/hubs jquery and it seems to be working fine as my client hub class is available in the javascript.
Any pointers on what i might be doing wrong.
You should be including "Scripts/jquery.signalR-1.0.1.min.js" after jQuery but before the "/signalr/hubs" script.
Look at Javascript + HTML Client section of http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-javascript-client for reference.

Web page navigation

I'm looking for guidelines for how to best implement web page navigation logic for a Spring based web application. For example: I have a web page 'C' where if I click ok, I want flow to return to page 'A' if that was the previous page, or page 'B' if that was the previous page. I am currently using hidden fields on a page to track from which page I arrived...but I think there must be a better way...
You can use flash scope bean for saving the view Url from which you are redirected.
You can read about flash scope from this page:
http://blog.smartkey.co.uk/2011/01/implementing-flash-scope-in-java-web-applications/
See me response from this post. it Explains how to implement Flash Scope in SPring MVC environment.
Spring MVC custom scope bean
with this scope you can alway retrieve the URL form which you will redirected and then build link form the value retrieved.
Hope it helps.
My suggestion would be to use Spring Web Flow (http://www.springsource.org/webflow).
It's intended to do exactly what you want. Control the flows between pages.
I start using it a couple of month ago and I love it.

ASP.NET MVC - HttpException visible in View Source in browser

I developed an asp.net mvc application. In one of my forms, I'm getting a following
exception:
A public action method 'UpdateBasket' could not be found on controller 'App.Controllers.WebShopController'
But the funny thing is, that form submit works (even in debug mode) and finds an
ActionMethod UpdateBasket and returns View.
The problem is that because of that html generated error
w3c validators and google crawlers can't access the site (I think so, correct me if I'm wrong).
Has anybody got any idea why this error occurs? Thank you.
Perhaps you're using Google Chrome to view the page source and you're encountering its tendency to reissue a "get" request for a post-only URL that your browser just "post"-ed to?
This is the best description I've found.

Receiving 404 "Missing Resource" error for Controller in ASP.Net MVC

I'm using ASP.Net MVC Design pattern and when adding a controller to my application I'm receiving the below error. I added the controller called EmailMeController.cs in the Controllers folder and everything builds correctly. I created a link to /EmailMe/ but that doesn't work. I've added another controller previously to the same site with no problems. Here's a link to my controller: http://pastebin.com/m373fae3b
Hopefully you guys can help. I certainly appreciate it.
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /EmailMe
Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927
Your only Index action in the controller is [AcceptVerbs(HttpVerbs.Post)]
You need an Index action for Get:
public ViewResult Index()
{
return View();
}
You have it as a POST method. You need an action for GET.
Add another ActionMethod with the [HTTPGet] annotation of the same name (MVC2).
After that, and you still get the 404, check that you add the asp.net dll for a wild card handler in your web app if you are using Windows server 2003 or earlier. If you are using 2008, make sure you actually have an application defined. I got hung on those too before.
Yet another thing to check is the Routes:
{controller}/{action}/{id}
If your method includes parameters other than id, it may not match.
For me, I removed default Views for the HomeController and ValueController which resulted in this problem. After adding all those views and controllers that comes as default when we create application i got rid of the error. Make sure you have those default views and controllers. This answer may help.

Access application settings from ASP.Net MVC View

In an ASP.Net MVC 1.0 applicati0n, is it possible to access the application settings (MyProject.Properties.Settings.Default.*) from inside my View (aspx page)?
I've tried but the intellisense and compiler don't like it. It says that it is inaccesible due to the protection level.
I had a similar issue to Saajid Ismail where my settings were in the namespace.Properties.Settings.Default.Setting they were there as they are strongly typed..
To make them accessible I simply had to change the access modifier
Your View should only be responsible for rendering data given to it by the Controller. It's responsibility is for layout. So I would recommend passing the Application data to the view from within your Controller action.
Having said that, the technical answer to your question is that ViewPage derives from Page, so you can simply do this:
<%= Context.Application["setting"] %>
But again, I don't recommend it.

Resources