URL Parameters not passing on sub pages server.transfer

I've been working on this for 2 weeks now.

Too much code to paste, but basically have a .NET 2.0 Web Application with a Company page, that has subpages down at the bottom.  about 9 of them.  this app was made back in 2000? when .NET first came out, so it was done half the old ASP way and half with new way, as the developer was learning .NET.

what is really weird is this app works fine on my local machine, debugging & iis server, & it works fine in our production environment.  but on Dev & Test it does not work.

it appears that on the CompanyRecord.aspx?MasterId=123&CoId=456   page when it gets to the bottom to do the sub page, it doe4s a server.transfer("Contacts.aspx?MasterID=123&CoId=456")
and when it goes to the Contacts.aspx i do a Request("MasterID") and it grabs blank.

but as I said, it works fine on my local machine & on prod.

what am I doing wrong??

I've checked the webconfig, compared IIS settings, I am not catching anything with my naked eye, although I don't know what every single option means.

plz help, thx.
Who is Participating?
OutOfTouchConnect With a Mentor Commented:
From MSDN:
The action attribute is always set to the URL of the page itself. The action attribute cannot be changed; therefore, you can only post back to the page itself.
Found here:
Sounds like you want to do a cross page postback:
Is True being set as the second parameter in the Server.Transer statement like this:
Server.Transfer("<page name>", True)
Do you get any error messages at all?
I think I have experienced the same problem once.

I'm almost definitely sure it's because of the behaviour of Server.Transfer, as this happends on the server side instead of the client side, so the querystring follow on the same way.

The first thing you should try is this:

//Preserve form
Server.Transfer("Contacts.aspx?MasterID=123&CoId=456", false);

If this doesn't work (it's really dependent on how the site is buildt) try the following which I'm almost sure will work:

//Client redirect
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

My bad, I meant true instead of false:

//Preserve form
Server.Transfer("Contacts.aspx?MasterID=123&CoId=456", true);
By default Server.Transer second parameter is false, there is also a bug in DotNet 1.0 when you set the second parameter to true. It is explained here:
purdyraAuthor Commented:
Thanks for the responses, it's truly appreciated.

The secondparameter of true did not work.
but...someone here suggested something, and it worked on this page now.
here is what we did:
it is basically 2 forms on the same page.  a master form and a subform, if you will.
the subform had:
<form id="Contacts" method="post" runat="server" action="mrcontacts.aspx">
we took off the action part, so now when it does the
Server.Transfer("Contacts.aspx?MasterID=123&CoId=456") it works.

but I am still curious why this didn't work before, becz there are 2 other pages that are erroring out in a similar way, and I am afraid I may not know of any other problems out there?

once again, it's working out in Prod and on my local machine, but dev & test servers this doesn't work.

thx again.
Did you try to use Response.Redirect("Contacts.aspx?MasterID=123&CoId=456") instead of Server.Transfer()?
purdyraAuthor Commented:
no, but I did try that prior to posting this question.

The way the website is built won't allow that.  
It has to run the master form first, then the subform, so it can display both.
I did not write it and the developer to his credit, was thrown into this, without knowing .NET since it was brand new.  He did the best he could.
I see.

Since it's made that way, perhaps you should look at other solutions that you normally wouldn't use?

I'm thinking about sessions and/or cookies. You could store the information in these instead of querystrings. Not optimal, but it should work.
purdyraAuthor Commented:
Why does this work on some environments and not on others?
Is there an IIS setting or machine.config or web.config setting I am missing?
purdyraAuthor Commented:
See, because now another page is erroring out that works fine on my local machine & on prod, but doesn't work on the dev or test environment.

<form id="CompanyInfo" method="post" runat="server" action="<%=mstrLink %>">

the action works on my local machine & prod, but on dev & Test it doesn't put the mstrLink variable
which is    CompanyInfo.aspx?MasterID=123&CoID=456
it just says, mstrLink.
it didn't interpret it.

any ideas what is causing all of this?
That sounds very weird. Obviously the ASP.NET engine don't want to parse your code correctly. Reinstall? Anyway, you should accept a solution here, and post a new question regarding your new problem in the IIS category, as there are more people there who might be able to solve this new problem of yours.
Ok, thx.
what do I do, since no one really answered my first question.

Someone here at my company suggested something, and that's what worked with that problem.

What should I do?  I don't know which option to choose?

You had alot of answers and I see there are many answers here that could easily be used to solve normal situations, but it seems that none of the answers fullfilled your question exactly 100%, which is rather rare anyway. Give the points to the user you think helped you the most, dedicated most time and tried to help you by offering solutions that quite possible would have worked for many others (but your situation was a seldom one obviously).

Good luck with your IIS problem!
BuginatorConnect With a Mentor Commented:
Altough it's not the answer to your original question, what OutOfTouch says is correct. I missed that obvious part because I was deceived by your strange problem that it works in some enviroments and in some it doesn't. That part is still very strange, as it should generate a problem on all the enviroments, no matter if it's a test server or production server.

Here is another solution which is somewhat related: If you want to change the postback url, this is what you do:
On the submit button on the form, go to its properties. There you can change the PostBackUrl. Here you can set the page you want the form to submit to.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.