Write session on redirect