urlfor from filter

17 views
Skip to first unread message

Simon -

unread,
Sep 12, 2016, 9:27:02 AM9/12/16
to beego-framework
Hello, 
how can i utilise urlfor within a filter like so (thankyou)

var FilterUser = func(ctx *context.Context) {
     ctx.Redirect(302,UrlFor("LoginController.Get")) //how can I access UrlFor from ctx?
}
instead of
var FilterUser = func(ctx *context.Context) {
      ctx.Redirect(302, "/login")
}

Asta Xie

unread,
Sep 12, 2016, 10:01:32 AM9/12/16
to Simon -, beego-framework

--
You received this message because you are subscribed to the Google Groups "beego-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beego-framework+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon -

unread,
Sep 12, 2016, 10:24:38 AM9/12/16
to beego-framework, auspa...@gmail.com
many thanks, I tried beego.UrlFor first but it seems it was uppercase URL, a bit unexpected.
Nice framework. 


On Tuesday, September 13, 2016 at 12:01:32 AM UTC+10, Asta Xie wrote:
On Mon, Sep 12, 2016 at 9:27 PM, Simon - <auspa...@gmail.com> wrote:
Hello, 
how can i utilise urlfor within a filter like so (thankyou)

var FilterUser = func(ctx *context.Context) {
     ctx.Redirect(302,UrlFor("LoginController.Get")) //how can I access UrlFor from ctx?
}
instead of
var FilterUser = func(ctx *context.Context) {
      ctx.Redirect(302, "/login")
}

--
You received this message because you are subscribed to the Google Groups "beego-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beego-framewo...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages