• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

URL Parameters not passing on sub pages server.transfer

Help!!!
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.
0
purdyra
Asked:
purdyra
  • 7
  • 4
  • 3
  • +1
2 Solutions
 
OutOfTouchCommented:
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?
0
 
BuginatorCommented:
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
Response.Redirect("Contacts.aspx?MasterID=123&CoId=456");
0
 
BuginatorCommented:
My bad, I meant true instead of false:

//Preserve form
Server.Transfer("Contacts.aspx?MasterID=123&CoId=456", true);
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
OutOfTouchCommented:
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:
http://support.microsoft.com/default.aspx?id=kb;en-us;Q316920
 
0
 
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.
0
 
BuginatorCommented:
Did you try to use Response.Redirect("Contacts.aspx?MasterID=123&CoId=456") instead of Server.Transfer()?
0
 
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.
0
 
BuginatorCommented:
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.
0
 
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?
0
 
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?
0
 
BuginatorCommented:
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.
0
 
purdyra1Commented:
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?

0
 
BuginatorCommented:
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!
0
 
OutOfTouchCommented:
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:
http://msdn.microsoft.com/en-us/library/dd120y50(VS.80).aspx
Sounds like you want to do a cross page postback:
 http://msdn.microsoft.com/en-us/library/ms178139(VS.80).aspx
 http://msdn.microsoft.com/en-us/library/x3x8t37x.aspx
 http://msdn.microsoft.com/en-us/library/ms178140.aspx
 
 
 
 
 
0
 
BuginatorCommented:
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.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now