The requested resource does not support HTTP method ‘GET’

Please use the attributes from the System.Web.Http namespace on your WebAPI actions: [System.Web.Http.AcceptVerbs(“GET”, “POST”)] [System.Web.Http.HttpGet] public string Auth(string username, string password) {…} The reason why it doesn’t work is because you were using the attributes that are from the MVC namespace System.Web.Mvc. The classes in the System.Web.Http namespace are for WebAPI.

laravel throwing MethodNotAllowedHttpException

You are getting that error because you are posting to a GET route. I would split your routing for validate into a separate GET and POST routes. New Routes: Route::post(‘validate’, ‘MemberController@validateCredentials’); Route::get(‘validate’, function () { return View::make(‘members/login’); }); Then your controller method could just be public function validateCredentials() { $email = Input::post(’email’); $password = Input::post(‘password’); … Read more

How do I redirect to the previous action in ASP.NET MVC?

try: public ActionResult MyNextAction() { return Redirect(Request.UrlReferrer.ToString()); } alternatively, touching on what darin said, try this: public ActionResult MyFirstAction() { return RedirectToAction(“MyNextAction”, new { r = Request.Url.ToString() }); } then: public ActionResult MyNextAction() { return Redirect(Request.QueryString[“r”]); }

express.js – single routing handler for multiple routes in a single line

I came across this question while looking for the same functionality. @Jonathan Ong mentioned in a comment above that using arrays for paths is deprecated but it is explicitly described in Express 4, and it works in Express 3.x. Here’s an example of something to try: app.get( [‘/test’, ‘/alternative’, ‘/barcus*’, ‘/farcus/:farcus/’, ‘/hoop(|la|lapoo|lul)/poo’], function ( request, … Read more

Routing with Multiple Parameters using ASP.NET MVC

Parameters are directly supported in MVC by simply adding parameters onto your action methods. Given an action like the following: public ActionResult GetImages(string artistName, string apiKey) MVC will auto-populate the parameters when given a URL like: /Artist/GetImages/?artistName=cher&apiKey=XXX One additional special case is parameters named “id”. Any parameter named ID can be put into the path … Read more

Angular2 Routing with Hashtag to page anchor

Update This is now supported <a [routerLink]=”[‘somepath’]” fragment=”Test”>Jump to ‘Test’ anchor </a> this._router.navigate( [‘/somepath’, id ], {fragment: ‘test’}); Add Below code to your component to scroll import {ActivatedRoute} from ‘@angular/router’; // <– do not forget to import private fragment: string; constructor(private route: ActivatedRoute) { } ngOnInit() { this.route.fragment.subscribe(fragment => { this.fragment = fragment; }); } … Read more

How do I remove the Devise route to sign up?

you can do this in your model # typical devise setup in User.rb devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable change it to: devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable notice that the symbol :registerable was removed That’s it, nothing else is required. All routes and links to registration page are magically removed too.

Passive Link in Angular 2 – equivalent

If you have Angular 5 or above, just change <a href=”” (click)=”passTheSalt()”>Click me</a> into <a [routerLink]=”” (click)=”passTheSalt()”>Click me</a> A link will be displayed with a hand icon when hovering over it and clicking it won’t trigger any route. Note: If you want to keep the query parameters, you should set queryParamsHandling option to preserve: <a … Read more

How can I find out the current route in Rails?

If you are trying to special case something in a view, you can use current_page? as in: <% if current_page?(:controller => ‘users’, :action => ‘index’) %> …or an action and id… <% if current_page?(:controller => ‘users’, :action => ‘show’, :id => 1) %> …or a named route… <% if current_page?(users_path) %> …and <% if current_page?(user_path(1)) … Read more