Solved

URL Parameters not passing on sub pages server.transfer

Posted on 2009-04-09
15
306 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
  • 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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 250 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 250 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now