?
Solved

Response.Redirect Syntax in ASP.NET

Posted on 2014-10-16
9
Medium Priority
?
341 Views
Last Modified: 2014-10-23
Hello Experts,

I'm having an issue with the syntax for the Response.Redirect command. I combined all the projects into 1 solution thinking this would be easier to use Session variables with and make the Response.Redirect more straightforward.

I'm initially launching the app from IPED_Hospice_Test.Login.aspx (http://localhost:57848/Login.aspx) and once validation occurs going to IPED_Reporting.ReportSelector.aspx (http://localhost:57848/IPED_Reporting/ReportSelector.aspx).  I'm using Response.Redirect("~/IPED_Reporting/ReportSelector.aspx", False) . I use the tilde because the pages are in different folders (as seen in the Solution Explorer screenshot).

In VS I've set to use the Development Server with port 57848, I've tried IIS and IIS Express. Any help will be appreciated.

Thank you,

Jack W
VS 2010 Solution Explorer
0
Comment
Question by:JackW9653
[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
  • 5
  • 4
9 Comments
 
LVL 5

Expert Comment

by:Bob Bender
ID: 40385435
Are you getting a 404 Error, or what?

If not mistaken, the  ~/  points you to the root of the website.   If that root is IPED_Reporting, then your entry of  "~/IPED_Reporting/ReportSelector.aspx" would be trying to go to an IPED_Reporting folder inside the root named IPED_Reporting.

I hope my thinking is right.

You might be able to use a Page TRACE, which would appear on your browser, it may help.  Instructions are at
http://msdn.microsoft.com/en-us/library/vstudio/94c55d08(v=vs.100).aspx 

Bob
0
 

Author Comment

by:JackW9653
ID: 40385450
Thanks Bob. Yes it's a 404 - Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

Requested URL: /IPED_Reporting/ReportSelector.aspx

i'll check out the Page Trace link and IPED_Reporting is not at the root of the website but a folder.

Jack
0
 

Author Comment

by:JackW9653
ID: 40385551
Bob, The Trace Link only fired for the Login page and it had the Session variables i was expecting but when it hit the Response.Redirect line I got the 404 again. I changed that line to Response.Redirect("/IPED_Reporting/ReportSelector.aspx") and  Response.Redirect("IPED_Reporting/ReportSelector.aspx") but got the 404 on both.

Any other ideas?

Jack
0
Cloud Training Guides

FREE GUIDES: In-depth and hand-crafted Linux, AWS, OpenStack, DevOps, Azure, and Cloud training guides created by Linux Academy instructors and the community.

 
LVL 5

Accepted Solution

by:
Bob Bender earned 2000 total points
ID: 40389605
Assuming that you are in the IPEDHospice folder when trying to run....

../IPEDReporting/IPEDReportSelector.aspx?    Meaning go back a level.... the go to the IPEDReporting folder, and open the page.
0
 

Author Comment

by:JackW9653
ID: 40392493
Hi Bob,

I tried the new target but I'm getting a different error, ' Cannot use a leading .. to exit above the top directory.' You know it's just sad when a different error is progress. Thanks for sticking with this.

Jack
0
 
LVL 5

Expert Comment

by:Bob Bender
ID: 40400072
Based on the pic above, what URL are you using to get to the point where the error occurs?
0
 

Author Comment

by:JackW9653
ID: 40400150
Hi Bob,

Thank you for following up on this. I wound up just combining the 2 projects and eliminated the problem. Now I'm using:                     Response.Redirect("~/ReportSelector.aspx", False), and this allows the Session ID to stay the same. The problem before was different Session variables.

Thanks again,

JackW9653
0
 

Author Closing Comment

by:JackW9653
ID: 40400154
Very thorough.
0
 
LVL 5

Expert Comment

by:Bob Bender
ID: 40400342
ahhhh, that wouldn't have been where I woulda thought.    Good to know what fixed it for future.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

777 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