?
Solved

URL Parameters not passing on sub pages server.transfer

Posted on 2009-04-09
15
Medium Priority
?
318 Views
Last Modified: 2012-05-06
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
Comment
Question by:purdyra
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 3
  • +1
15 Comments
 
LVL 3

Expert Comment

by:OutOfTouch
ID: 24110563
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
 
LVL 5

Expert Comment

by:Buginator
ID: 24110587
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
 
LVL 5

Expert Comment

by:Buginator
ID: 24110593
My bad, I meant true instead of false:

//Preserve form
Server.Transfer("Contacts.aspx?MasterID=123&CoId=456", true);
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Expert Comment

by:OutOfTouch
ID: 24110607
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
 

Author Comment

by:purdyra
ID: 24111094
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
 
LVL 5

Expert Comment

by:Buginator
ID: 24111129
Did you try to use Response.Redirect("Contacts.aspx?MasterID=123&CoId=456") instead of Server.Transfer()?
0
 

Author Comment

by:purdyra
ID: 24111242
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
 
LVL 5

Expert Comment

by:Buginator
ID: 24111318
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
 

Author Comment

by:purdyra
ID: 24129602
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
 

Author Comment

by:purdyra
ID: 24131041
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
 
LVL 5

Expert Comment

by:Buginator
ID: 24131591
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
 

Expert Comment

by:purdyra1
ID: 24132267
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
 
LVL 5

Expert Comment

by:Buginator
ID: 24132333
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
 
LVL 3

Accepted Solution

by:
OutOfTouch earned 750 total points
ID: 24133177
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
 
LVL 5

Assisted Solution

by:Buginator
Buginator earned 750 total points
ID: 24133288
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question