0

I am building module to register customers and after registration i need to redirect the user to home page (default). I cant see a way as in Orchard everything works as content items.

Some of my code from Controller is given below

             $ if (!ModelState.IsValid)
            return new ShapeResult(this, _services.New.Checkout_Signup(Signup:  signup));

        var customer = _customerService.CreateCustomer(signup.Email, signup.Password);
        customer.FirstName = signup.FirstName;
        customer.LastName = signup.LastName;
        customer.Title = signup.Title;

        _authenticationService.SignIn(customer.User, true);

        return Redirect("~/Home Page URL here...");
4

1 回答 1

2

在 Orchard 中,主页的别名为空字符串。RouteValueDictionary可以通过调用该IAliasService.Get()方法来查找别名的。一旦你有了这个,你可以简单地将它传递给RedirectToRoute().

所以对于主页:

var homepage = _aliasService.Get(String.Empty);
return RedirectToRoute(homepage);

AutoroutePartDriver.cs您可以看到 Orchard在 1.7.2 版本中使用此机制检查文件第 66 - 72 行中的主页。

于 2014-01-01T01:35:00.650 回答