Last post Jun 25, 2019 08:10 PM by Valdier
Jun 20, 2019 11:36 PM|Valdier|LINK
I have some fairly simple code that works perfectly on my local machine, but when run on the server I'm deploying it to, acts very differently.
If I type into the url bar of the browser:
I can write the parameter to a label and see that it gets passed perfectly.
When I deploy it to the Server 2016 instance
The url remains with parameters and I can clearly see that no parameters are making it to the Request.QueryString["param1"]; call
This is a fresh install and so I'm confused as to why it's acting so differently between IIS10 on windows 10 and IIS10 on 2016.
Jun 21, 2019 06:35 AM|AddWeb Solution|LINK
protected void PostButton_Click(object sender, EventArgs e)
Response.Redirect("~/default.aspx?title=" + textbox1.text);
protected void Page_Load(object sender, EventArgs e)
// Get Querystring for Title, if it exists
string pageTitle = Request.QueryString["title"];
PageTitleTextBox.Text = pageTitle;
You can refer below link for more understanding
Jun 21, 2019 03:33 PM|Valdier|LINK
I'm aware of how to get the request parameters from the query string.
What I mentioned was, the querystring parameters are "dropped" when I run the aspx page on the server vs on a local box.
Jun 24, 2019 04:42 PM|Valdier|LINK
Just bumping hoping for some insight
Jun 25, 2019 07:47 AM|Fei Han - MSFT|LINK
The above code sees the parameter on my local machine, or when run from VS with IIS Express. On the server it ignores the parameter string (testing for parameters shows no parameters are ever sent)
Do you mean that you always can not get QueryString in your code when you browse web page
http(s)://xxxx/page.aspx?report=blahblah hosting on your IIS?
Jun 25, 2019 09:16 AM|PatriceSc|LINK
Which value do you see in Label1/Label2 so that we can understand which branch is taken? You really saw directly no QueryString is found (ie QueryString.AllKeys.Length or something like that) or do you assume that based on the code behavior.
Make sure to code for what you expect. For example retuning null on an Exception could be counter productive.
Ultimately if I really have a doubt about the incoming http request, I'm using https://docs.microsoft.com/en-us/dotnet/api/system.web.httprequest.saveas?view=netframework-4.8 to
save and inspect the request but for now I rather expect what happens is currenly obscured by your code.
Jun 25, 2019 03:24 PM|Valdier|LINK
Yes, when running on the Server 2016 instance, I get no query string results at all. When running on local (IIS on Win 10, or IIS Express), I get the expected results and my application is able to process the string.
I have to assume it's some kind of setting that must be configured on the Server instance, but can't for the life of me find anything that would apply.
Jun 25, 2019 03:58 PM|Valdier|LINK
Ok, good, question... this opened up another whole line of not know whats happening.
Resolved, not a code issue.
Jun 25, 2019 04:58 PM|Valdier|LINK
I have gone in to check that .aspx is set to prevent all caching both at user mode and kernel mode (and restarted the server).
Jun 25, 2019 08:10 PM|Valdier|LINK
I've resolved this.
For whatever reason, when the copy was being made to the server (I assume permissions in the rdp session), the aspx file was copying just fine but the bin folder was not being refreshed. I've replicated over the bin folder and am now seeing the expected