Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a HotTowel site with login (facebook, twitter, google, microsoft)?

I am creating the site using the following steps.

  1. Create a Asp.net Mvc 4 web application with standard "Internet application" template. So the login code is created. Then update all referenced code use NuGet.
  2. Run Install-Package HotTowel and update all code using NeGet.

When I run the code.

  1. It will go direct to the HotTowel HotTowel\index.cshtml instead of the page Home\Index.cshtml which has login code.
  2. The generated html code of HotTowel\index.cshtml is wrapped in the generated html code of Shared\_Layout.cshtml.

What I want is

The site shows the login page first, and redirect to the HotTowel home page after logged in.

Update:

I tried to Install HotTowel on a pre-created built-in SPA project and got the similar issues.

Update 2:

I found that commenting out the following lines in the file HotTowelRouteConfig.cs will make sure the start page go to Home\Index.cshtml.

[assembly: WebActivator.PreApplicationStartMethod(
  typeof(test4.App_Start.HotTowelRouteConfig), "RegisterHotTowelPreStart", Order = 2)]
like image 372
ca9163d9 Avatar asked Nov 03 '22 17:11

ca9163d9


1 Answers

in your global.asax you need to add new route

routes.MapRoute(
            "Default",                                              // Route name
            "{controller}/{action}/{id}",                           // URL with parameters
            new { controller = "Account", action = "Login", id = "" }  // Parameter defaults
        );

and your login ends on return Redirect("/"); or return RedirectToAction("HotTowel","index");

like image 108
Timur Shahbanov Avatar answered Nov 08 '22 07:11

Timur Shahbanov