routes

How to Generate absolute urls with https in MVC3?

夙愿已清 提交于 2019-11-29 03:09:35
I am using MVC3 and am trying to serve content from https, the problem is that when I call Url.Content the files are still served from http using a relative url. I thought this problem was addressed in MVC3 but i can't seem to find any solution. Does anybody know if this issue is inherently solved in MVC3 and how to accomplish it or do I need to create my own helper methods to generate absolute Urls based on protocol? You can probably implement your own solution using VirtualPathUtility.ToAbsolute . Probably something like this: public static class UrlHelperExtension { public static string

How to define route group name in laravel

别等时光非礼了梦想. 提交于 2019-11-29 03:09:19
Is there any way to define the name of route group in laravel? What I'm trying to accomplish by this is to know that the current request belongs to which group so I can make active the main menu and sub menu by the current route action: Code: Route::group(['prefix'=>'accounts','as'=>'account.'], function(){ Route::get('/', 'AccountController@index')->name('index'); Route::get('connect', 'AccountController@connect')->name('connect'); }); Route::group(['prefix'=>'quotes','as'=>'quote.'], function(){ Route::get('/', 'QuoteController@index')->name('index'); Route::get('connect', 'QuoteController

Rails3 + Devise: When to nest resource in devise_for & nested resources

匆匆过客 提交于 2019-11-29 02:53:36
问题 When should I nest routes in the devise_for block? Please give one or two examples to show the use case. (Routes #1) If :foo_object is associated with :users so :user has_one :foo_object , do I need to nest :foo_object under :users ? (Routes #2) :users is the devise :users model. Routes #1: devise_for :users resource :foo_object Routes #2: devise_for :users resources :users do resource :foo_object end 回答1: The following example: devise_for :users, :path => 'accounts' resources :users do

How do I access a route parameter in my ASP.NET MVC view?

别说谁变了你拦得住时间么 提交于 2019-11-29 02:38:39
问题 I have an URL like this /home/action/id How can I access this id in view? 回答1: This should work in your view: <%= this.ViewContext.RouteData.Values["id"] %> (assuming the route parameter is named "id") 回答2: you can pass it in through viewData; In your Controller: public ActionResult Index(string id) { ViewData["Name"] = Server.UrlEncode(id); return View(); } In your View: <h1><%= ViewData["Name"] %></h1> 来源: https://stackoverflow.com/questions/2380867/how-do-i-access-a-route-parameter-in-my

Flutter Redirect to a page on initState

元气小坏坏 提交于 2019-11-29 02:13:34
问题 I have an application where you need to log in to continue (for example with Google). I would like to redirect the user when the authentification is needed. However when I run a Navigator.of(context).pushNamed("myroute") . I got the following error: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ I/flutter ( 5624): The following assertion was thrown building _ModalScopeStatus(active): I/flutter ( 5624): setState() or markNeedsBuild() called

event.preventDefault() not working for routeChangeStart in angularjs app

五迷三道 提交于 2019-11-29 01:33:44
Hope any angularjs gurus can help me with this.Here is my angularjs code $scope.$on('$routeChangeStart', function(event, next, current) { if ($scope.myForm.$dirty) { if(!confirm("Unsaved, do u want to continue?")) { event.preventDefault(); } } }); It alerts in browser back button click when data is dirty, but on clicking cancel or ok it still completes the route change.Seems like event.preventDefault() is not working. Can any one point out what may be wrong I had lots of trouble finding this one, but instead of the "$routeChangeStart" event, you can listen to the "$locationChangeStart" event,

Optionally override request culture via url/route in an ASP.NET Core 1.0 Application

与世无争的帅哥 提交于 2019-11-29 01:33:41
问题 I am trying to override the culture of the current request. I got it working partly using a custom ActionFilterAttribute . public sealed class LanguageActionFilter : ActionFilterAttribute { private readonly ILogger logger; private readonly IOptions<RequestLocalizationOptions> localizationOptions; public LanguageActionFilter(ILoggerFactory loggerFactory, IOptions<RequestLocalizationOptions> options) { if (loggerFactory == null) throw new ArgumentNullException(nameof(loggerFactory)); if

Rails: how to use scope with params and use route with default value of params

对着背影说爱祢 提交于 2019-11-29 00:56:38
问题 I have such lines in routes.rb: scope "/:subdomain/" do resource :order, :only => [:new, :create, :show, :update, :edit, :destroy] do get :cancel, :on => :member put :counter, :on => :member end end And for example, this is typical url: http://mydomain.com/some_subdomain/order/new . This url is mapped to action new of orders controller with params[:subdomain] = "some_subdomain". I want to use named route new_order_url(:subdomain => "some_subdomain"). But I want to map http://mydomain.com

Getting Rails URL helpers to automatically output https urls

狂风中的少年 提交于 2019-11-29 00:34:30
问题 I am developing a site that mixes http and https a lot - whats the best/easiest way to make the links use the right protocol for the route - can it be specified in the routes file? Say I have the following route in Rails 3. match "/test" => "test#index", :as => :test, :constraints => { :protocol => 'https' } If I'm on a http page, and I use test_url() , it'll output http://domain.com/test. I want https://domain.com/test instead. I know I can use test_url(:secure => true) , but that's

Rails 3 Custom Route that takes multiple ids as a parameter

故事扮演 提交于 2019-11-29 00:17:13
How do I add a route to my Rails 3 app which allows me to have a URL that maps to an action in a RESTful resource that accepts multiple parameters: /modelname/compare/1234,2938,40395 And then in my controller, I want to access these ids: @modelname = Modelname.find(params[:modelname_ids]) So far, I have been trying match '/modelname/compare/:modelname_ids', :to => 'modelname#compare' , but I keep getting No route matches "/modelname/compare/4df632fd35be357701000005,4df632fd35be357701000005" . Any suggestions? You can setup a route that matches anything, then split the parameter inside your