Я создаю приложение ASP.NET.
Это страница Pagina.aspx, это код:
namespace AnalisiHRVElaborazioni
{
public partial class Pagina : System.Web.UI.Page
{
OmniaCareRehabDemProductionEntities dbTool = new OmniaCareRehabDemProductionEntities();
static HttpClient client = new HttpClient();
protected void Page_Load(object sender, EventArgs e)
{
int? locateInput = null;
int? replaceMethod = null;
int? replaceInput = null;
int? detrendMethod = null;
int? waveletLevels = null;
int? smoothMethod = null;
int? smoothSpan = null;
double? smoothDegree = null;
int? polyOrder = null;
int? meanCorrection = null;
int? resampleRate = null;
int? lambda = null;
int? sdnni = null;
int? pnnx = null;
int? tFWindow = null;
int? tFOverlap = null;
int? m = null;
double? r = null;
int? n1 = null;
int? n2 = null;
int? breakpoint = null;
double vlfMin;
double vlfMax;
double lfMin;
double lfMax;
double hfMin;
double hfMax;
int? arOptionOrder = null;
int? winWith = null;
int? winOverlap = null;
int? pointPSD = null;
int? interpolationRate = null;
String idSlot = Request.QueryString["idSlot"];
if (!String.IsNullOrEmpty(idSlot))
{
Response.Redirect("Home/TimeDomain");
}
else
{
String charMethod = Request.QueryString["charMethod"];
String _locateInput = Request.QueryString["locateInput"];
String _replaceMethod = Request.QueryString["replaceMethod"];
String _replaceInput = Request.QueryString["replaceInput"];
String _detrendMethod = Request.QueryString["detrendMethod"];
String _waveletLevels = Request.QueryString["waveletLevels"];
if (!String.IsNullOrEmpty(_locateInput))
locateInput = int.Parse(_locateInput);
if (!String.IsNullOrEmpty(_replaceMethod))
replaceMethod = int.Parse(_replaceMethod);
if (!String.IsNullOrEmpty(_replaceInput))
replaceInput = int.Parse(_replaceInput);
if (!String.IsNullOrEmpty(_detrendMethod))
detrendMethod = int.Parse(_detrendMethod);
if (!String.IsNullOrEmpty(_waveletLevels))
waveletLevels = int.Parse(_waveletLevels);
RR rr = new RR();
RR.Filter filter = new RR.Filter();
filter.locateInput = locateInput;
filter.replaceMethod = replaceMethod;
filter.replaceInput = replaceInput;
filter.detrendMethod = detrendMethod;
filter.waveletLevels = waveletLevels;
//recupero l'RR
rr.rr = getRR(10);
rr.filter = filter;
var json = new JavaScriptSerializer().Serialize(rr);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost:28302/api/parse");
request.Method = "POST";
System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
Byte[] byteArray = encoding.GetBytes(json);
request.ContentLength = byteArray.Length;
request.ContentType = @"application/json";
using (Stream dataStream = request.GetRequestStream())
{
dataStream.Write(byteArray, 0, byteArray.Length);
}
long length = 0;
try
{
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
length = response.ContentLength;
Stream stream = response.GetResponseStream();
StreamReader sr = new StreamReader(stream);
var jsonObject = new JavaScriptSerializer().DeserializeObject(sr.ReadToEnd());
//ottenuto l oggetto posso mettere tutto in sessione
Session["jsonElaborato"] = jsonObject;
Session["loadJson"] = true;
Response.Redirect("Home/TimeDomain/?idSlot=null");
}
}
catch (WebException ex)
{
// Log exception and throw as for GET example above
}
}
}
[NonAction]
public decimal?[] getRR(int idSlot)
{
/**
* qui devo recuperare il codice per recuperare le informazioni real time dal database
* */
return (from r in dbTool.AA_V_RRSlotXRR
where r.IdSlotRR == idSlot
select r.y).ToArray();
}
}
}
Я вызываю эту страницу с таким URL:
http://localhost:12636/Pagina.aspx/?charMethod="percent"&locateInput=900.....
Если я попытаюсь вызвать эту страницу.Я могу выполнить весь код и вызвать веб-сервис.
Затем, после выполнения этих строк кода
Session["jsonElaborato"] = jsonObject;
Session["loadJson"] = true;
Response.Redirect("Home/TimeDomain/?idSlot=null");
Я ожидаю, что система перенаправит браузер на страницу Home/TimeDomain
.Но, к сожалению, страница всегда перенаправлена на страницу Pagina.aspx
.Почему?