質問編集履歴
3
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -215,3 +215,203 @@
|
|
215
215
|
IIS:10.0 Express
|
216
216
|
|
217
217
|
Visual Studio:2017 Community
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
### SurferOnWww様のご回答を受けてのソース
|
222
|
+
|
223
|
+
a.aspx
|
224
|
+
|
225
|
+
```aspx
|
226
|
+
|
227
|
+
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="a.aspx.cs" Inherits="TransferTest.a" %>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
<!DOCTYPE html>
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
236
|
+
|
237
|
+
<head runat="server">
|
238
|
+
|
239
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
240
|
+
|
241
|
+
<title></title>
|
242
|
+
|
243
|
+
</head>
|
244
|
+
|
245
|
+
<body>
|
246
|
+
|
247
|
+
<form id="form1" runat="server">
|
248
|
+
|
249
|
+
<div>
|
250
|
+
|
251
|
+
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
|
252
|
+
|
253
|
+
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
|
254
|
+
|
255
|
+
</div>
|
256
|
+
|
257
|
+
</form>
|
258
|
+
|
259
|
+
</body>
|
260
|
+
|
261
|
+
</html>
|
262
|
+
|
263
|
+
```
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
a.aspx.cs
|
268
|
+
|
269
|
+
```C#
|
270
|
+
|
271
|
+
using System;
|
272
|
+
|
273
|
+
using System.Collections.Generic;
|
274
|
+
|
275
|
+
using System.Linq;
|
276
|
+
|
277
|
+
using System.Web;
|
278
|
+
|
279
|
+
using System.Web.UI;
|
280
|
+
|
281
|
+
using System.Web.UI.WebControls;
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
namespace TransferTest
|
286
|
+
|
287
|
+
{
|
288
|
+
|
289
|
+
public partial class a : System.Web.UI.Page
|
290
|
+
|
291
|
+
{
|
292
|
+
|
293
|
+
protected void Page_Load(object sender, EventArgs e)
|
294
|
+
|
295
|
+
{
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
}
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
protected void Button1_Click(object sender, EventArgs e)
|
304
|
+
|
305
|
+
{
|
306
|
+
|
307
|
+
Session["id"] = TextBox1.Text;
|
308
|
+
|
309
|
+
// SerferOnWww様のご回答ではここで Session["A.aspx.SpecialKeyName"] にするということでしょうか?
|
310
|
+
|
311
|
+
Response.Redirect("b.aspx");
|
312
|
+
|
313
|
+
}
|
314
|
+
|
315
|
+
}
|
316
|
+
|
317
|
+
}
|
318
|
+
|
319
|
+
```
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
b.aspx
|
324
|
+
|
325
|
+
```aspx
|
326
|
+
|
327
|
+
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="b.aspx.cs" Inherits="TransferTest.b" %>
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
<!DOCTYPE html>
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
336
|
+
|
337
|
+
<head runat="server">
|
338
|
+
|
339
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
340
|
+
|
341
|
+
<title></title>
|
342
|
+
|
343
|
+
</head>
|
344
|
+
|
345
|
+
<body>
|
346
|
+
|
347
|
+
<form id="form1" runat="server">
|
348
|
+
|
349
|
+
<div>
|
350
|
+
|
351
|
+
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
|
352
|
+
|
353
|
+
</div>
|
354
|
+
|
355
|
+
</form>
|
356
|
+
|
357
|
+
</body>
|
358
|
+
|
359
|
+
</html>
|
360
|
+
|
361
|
+
```
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
b.aspx.cs
|
366
|
+
|
367
|
+
```C#
|
368
|
+
|
369
|
+
using System;
|
370
|
+
|
371
|
+
using System.Collections.Generic;
|
372
|
+
|
373
|
+
using System.Linq;
|
374
|
+
|
375
|
+
using System.Web;
|
376
|
+
|
377
|
+
using System.Web.UI;
|
378
|
+
|
379
|
+
using System.Web.UI.WebControls;
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
namespace TransferTest
|
384
|
+
|
385
|
+
{
|
386
|
+
|
387
|
+
public partial class b : System.Web.UI.Page
|
388
|
+
|
389
|
+
{
|
390
|
+
|
391
|
+
string strId;
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
protected void Page_Load(object sender, EventArgs e)
|
396
|
+
|
397
|
+
{
|
398
|
+
|
399
|
+
if (!IsPostBack)
|
400
|
+
|
401
|
+
{
|
402
|
+
|
403
|
+
strId = Session["id"].ToString(); // ←ここで別タブのSession["id"]が上書きされてしまうのでは、と考えました。
|
404
|
+
|
405
|
+
Session["id"].Remove();
|
406
|
+
|
407
|
+
Label1.Text = strId;
|
408
|
+
|
409
|
+
}
|
410
|
+
|
411
|
+
}
|
412
|
+
|
413
|
+
}
|
414
|
+
|
415
|
+
}
|
416
|
+
|
417
|
+
```
|
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
2
|
|
3
|
-
Page1でButtonを押した時、HiddenFieldの値を設定してPage2へPOSTしたいのですが、Buttton1_Click()内でHiddenField
|
3
|
+
Page1でButtonを押した時、HiddenFieldの値を設定してPage2へPOSTしたいのですが、Buttton1_Click()内でHiddenFieldに値を設定後、Server.Transfer()をすると値が設定できない上にURLがPage1のままなので都合が悪く(ユーザーにブックマークされたくない)、Response.Redirect()だとGETしか出来ないようなので使用を断念しています。
|
4
4
|
|
5
5
|
ButtonのPostBackUrlを使用するとHiddenFieldの値を設定するタイミングが分からず・・・。
|
6
6
|
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -208,10 +208,10 @@
|
|
208
208
|
|
209
209
|
### 補足情報(FW/ツールのバージョンなど)
|
210
210
|
|
211
|
-
|
211
|
+
OS:Windows7
|
212
212
|
|
213
213
|
.NET:4.0
|
214
214
|
|
215
|
-
|
215
|
+
IIS:10.0 Express
|
216
216
|
|
217
217
|
Visual Studio:2017 Community
|