从MVC中的付款网关重定向后,会话无法正常工作

时间:2020-01-16 12:18:36

标签: asp.net-mvc

我的会话创建代码位于

下方
class MainWidget extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return MainWidgetState();
  }
}

class MainWidgetState extends State<MainWidget> {
//  list of the child widget
  List<ChildWidget> listChildWidget = [];

  void addChildWidget() {
    setState(() {
      listChildWidget.add(ChildWidget());
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: new AppBar(
        title: new Text('Test'),
      ),
      floatingActionButton: FloatingActionButton(
          child: Icon(Icons.add),
          onPressed: () {
            addChildWidget();
          }),
      body: new Column(
        children: <Widget>[
          Expanded(
              child: new ListView.builder(
                  itemCount: listChildWidget.length,
                  itemBuilder: (context, index) {
                    return new ListTile(title: listChildWidget[0]);
                  })),

          // Get summary of all the list items
          RaisedButton(
              child: Text('Get Summary'),
              onPressed: (){
            // Get the list of all the textField values and their modified
            // counter values

          })
        ],
      ),
    );
  }
}

class ChildWidget extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return ChildWidgetState();
  }
}

class ChildWidgetState extends State<ChildWidget> {
  int counterValue = 0;
  TextEditingController myTextController;

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return new Row(
      children: <Widget>[
        // counter name
        Container(
          child: TextField(
            controller: myTextController,
            textAlign: TextAlign.center,
          ),
          width: 100.0,
        ),

        // counter text
        Text(counterValue.toString()),

        // increases the counter value
        IconButton(
            icon: Icon(Icons.add_circle),
            onPressed: () {
              setState(() => counterValue += 1);
            })
      ],
    );
  }
}

当我们收到付款网关的回复时,我收到代码的会话在下面

public ActionResult TestReq()
{ 
   Session["mydata"] = "xyz";
}

但是我们获得了会话值 public ActionResult TestRes() { var result = Session["mydata"]; }

0 个答案:

没有答案