Solved

URL Parameters not passing on sub pages server.transfer

Posted on 2009-04-09
15
304 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
Comment Utility
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
Comment Utility
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
Comment Utility
My bad, I meant true instead of false:

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

Expert Comment

by:OutOfTouch
Comment Utility
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
Comment Utility
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
Comment Utility
Did you try to use Response.Redirect("Contacts.aspx?MasterID=123&CoId=456") instead of Server.Transfer()?
0
 

Author Comment

by:purdyra
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 5

Expert Comment

by:Buginator
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

728 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

12 Experts available now in Live!

Get 1:1 Help Now