473,654 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

#If DEBUG and Response.Redire ct

I have noticed that this:

Response.Redire ct("/MyLocalDirector y/MyPage.aspx")

seems to be a lot quicker than this:

Response.Redire ct(sDirectorySt ring & "MyPage.asp x")
In local development mode, I need to have sDirectoryStrin g equal to my
local folder structure, but when I upload the project to a webserver,
the sDirectoryStrin g needs to contain a value equal to the webserver
folder structure.

Rather than have the sDirectoryStrin g variable scenario above which
seems to really slow the Redirect operation down, would this be a much
better approach:

#If DEBUG Then
Response.Redire ct("/MyLocalDirector y/MyPage.aspx")
#Else
Response.Redire ct("/MyServerDirecto ry/MyPage.aspx")
#End If

Thanks a lot, from dnw.
Nov 18 '05 #1
4 3706
Don't like.

(a) the first shouldn't be "a lot" quicker than the second...it shouldn't be
noticable by any means
(b) You shoulnd't hard code paths into the application...w hat if you have a
3rd server, like a testing one, you'll add another compilation constant and
#else if that?

My suggestion is to stick with the 2nd one and figure out why it's so much
slower. Also, sDirectoryStrin g should be fed from a config file (web.config
is fine) so that it can easily be changed.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Dot net work" <do***@hotmail. com> wrote in message
news:77******** *************** ***@posting.goo gle.com...
I have noticed that this:

Response.Redire ct("/MyLocalDirector y/MyPage.aspx")

seems to be a lot quicker than this:

Response.Redire ct(sDirectorySt ring & "MyPage.asp x")
In local development mode, I need to have sDirectoryStrin g equal to my
local folder structure, but when I upload the project to a webserver,
the sDirectoryStrin g needs to contain a value equal to the webserver
folder structure.

Rather than have the sDirectoryStrin g variable scenario above which
seems to really slow the Redirect operation down, would this be a much
better approach:

#If DEBUG Then
Response.Redire ct("/MyLocalDirector y/MyPage.aspx")
#Else
Response.Redire ct("/MyServerDirecto ry/MyPage.aspx")
#End If

Thanks a lot, from dnw.

Nov 18 '05 #2
Dot net work wrote:
I have noticed that this:

Response.Redire ct("/MyLocalDirector y/MyPage.aspx")

seems to be a lot quicker than this:

Response.Redire ct(sDirectorySt ring & "MyPage.asp x")
In local development mode, I need to have sDirectoryStrin g equal to my
local folder structure, but when I upload the project to a webserver,
the sDirectoryStrin g needs to contain a value equal to the webserver
folder structure.

Rather than have the sDirectoryStrin g variable scenario above which
seems to really slow the Redirect operation down, would this be a much
better approach:

#If DEBUG Then
Response.Redire ct("/MyLocalDirector y/MyPage.aspx")
#Else
Response.Redire ct("/MyServerDirecto ry/MyPage.aspx")
#End If

Thanks a lot, from dnw.


If a path is processed by asp.net (as with Response.Redire ct) you can use a
"hidden" feature: When you start the path with a ~, then that will be replaced
by the application path. So you can just say:

Response.Redire ct("~/MyPage.aspx")

and it works both on your dev-machine and your live server.

Hans Kesting
Nov 18 '05 #3
Thanks for your suggestion.

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:<ui******* ******@TK2MSFTN GP11.phx.gbl>.. .
Don't like.

(a) the first shouldn't be "a lot" quicker than the second...it shouldn't be
noticable by any means
(b) You shoulnd't hard code paths into the application...w hat if you have a
3rd server, like a testing one, you'll add another compilation constant and
#else if that?

My suggestion is to stick with the 2nd one and figure out why it's so much
slower. Also, sDirectoryStrin g should be fed from a config file (web.config
is fine) so that it can easily be changed.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Dot net work" <do***@hotmail. com> wrote in message
news:77******** *************** ***@posting.goo gle.com...
I have noticed that this:

Response.Redire ct("/MyLocalDirector y/MyPage.aspx")

seems to be a lot quicker than this:

Response.Redire ct(sDirectorySt ring & "MyPage.asp x")
In local development mode, I need to have sDirectoryStrin g equal to my
local folder structure, but when I upload the project to a webserver,
the sDirectoryStrin g needs to contain a value equal to the webserver
folder structure.

Rather than have the sDirectoryStrin g variable scenario above which
seems to really slow the Redirect operation down, would this be a much
better approach:

#If DEBUG Then
Response.Redire ct("/MyLocalDirector y/MyPage.aspx")
#Else
Response.Redire ct("/MyServerDirecto ry/MyPage.aspx")
#End If

Thanks a lot, from dnw.

Nov 18 '05 #4
That's cool, thanks.

I have found a nice overall solution for my dilemna.

I now have the following folder structure inside my project:

ASPXs/Home 'Home page just goes in here for neatness.
ASPXs/Authentication
ASPXs/NonAuthenticati on

When I need to move about, all I need to do is:

Response.Redire ct("../<one of the three folders
above>/MyChosenPage.as px

This will work on any machine with the easy-to-create folder structure
above.

(Previously, I had the Default.aspx sitting in a different sub folder
level in my project, and it was causing all sorts of "path access type
problems".)
"Hans Kesting" <ne***********@ spamgourmet.com > wrote in message news:<e0******* *******@TK2MSFT NGP12.phx.gbl>. ..
Dot net work wrote:
I have noticed that this:

Response.Redire ct("/MyLocalDirector y/MyPage.aspx")

seems to be a lot quicker than this:

Response.Redire ct(sDirectorySt ring & "MyPage.asp x")
In local development mode, I need to have sDirectoryStrin g equal to my
local folder structure, but when I upload the project to a webserver,
the sDirectoryStrin g needs to contain a value equal to the webserver
folder structure.

Rather than have the sDirectoryStrin g variable scenario above which
seems to really slow the Redirect operation down, would this be a much
better approach:

#If DEBUG Then
Response.Redire ct("/MyLocalDirector y/MyPage.aspx")
#Else
Response.Redire ct("/MyServerDirecto ry/MyPage.aspx")
#End If

Thanks a lot, from dnw.


If a path is processed by asp.net (as with Response.Redire ct) you can use a
"hidden" feature: When you start the path with a ~, then that will be replaced
by the application path. So you can just say:

Response.Redire ct("~/MyPage.aspx")

and it works both on your dev-machine and your live server.

Hans Kesting

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3899
by: Paul | last post by:
I'm not getting the results I want when I use Response.Redirct in a ASP page. I enter this line of code in a asp page from domain1.com. Response.Redirect "http://www.domain2.com/VDIR2/table.asp" & "?PubID=" & PubID & "&PubName=" & PubName The query string is data to open a DB. the page displays
3
7769
by: Bill Cohagan | last post by:
I'm writing a console app (in C#) and I want to be able to redirect the standard input/output streams when it's run at a command prompt. IOW I want to support the "<" and ">" redirection syntax. The obvious way to do this is by using the static Console type properties, In and Out. When trying to debug the app in the IDE however, this doesn't appear to work. I've edited the project properties and added the necessary text to the "command...
8
2465
by: ST | last post by:
Hello everyone, Can anyone help me with this error above when I debug my web app project in vstudio.net?? I can't figure it out! It was working fine for months, and now all of a sudden it's not!! This is the error: biopsy.searchsubject.btnSubject_Click(Object Sender, EventArgs e) in C:\INetPub\WWWRoot\biopsy\searchsubject.aspx.vb:198 System.Web.UI.WebControls.Button.OnClick(EventArgs e)
0
1008
by: Max | last post by:
Can anyone point me towards reasons why Response.Redirect would work ok when running without debugging (via "Start without debugging" menu choice) but be really really slow when running in debug mode? When starting without debugging, the redirect is almost instantaneous, but with debugging it takes up to a minute or longer (though it does eventually succeed). CPU usage pegs during the delay with devenv.exe taking up most of it. This...
1
2384
by: joemynz | last post by:
Help please with a URLError. Invoking a url that works in Firefox and IE results in a "urlerror 7, no address ..." in python. I need to debug why. Traceback is below. There's a redirect when the url is invoked (it's part of a chain) - you can see it using liveheaders in firefox. What is the best way to debug this? I tried setting debug on HTTPConnection but this doesn't work (from some web posts, setting debug is broken in 2.4). What's...
46
24209
by: Ian Boyd | last post by:
IIS5, on a Windows 2000 Server machine. Debeg.WriteLine "Hello, world!" How can i view it?
5
4561
by: venner | last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET 2.0. The website makes use of a central authentication service (CAS) provided at the university I work for. Each page checks a session variable, and if it is not present, does a Response.Redirect to a webpage for the CAS passing a url parameter for the url to post back to. The CAS provides a page for the user to log into, validates the username and password, and then...
4
11425
by: mike.biang | last post by:
I have an ASP page that is using an XMLHTTP object to request various pages from my server. I keep a single session throughout the XMLHTTP requests by bassing the ASPSESSIONID cookie through the XMLHTTP object. However, when the page requested through the XML object makes a <%Response.Redirect()%> call, a new session is created each time. Is this a flaw in the XMLHTTP Object? How can I force the session to remain the same after a...
9
4340
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case). The browser then makes a new request to the server to redirect itself to abcd.asp after which the user gets redirected to abcd.asp. But in case of Server.Execute (or Server.Transfer), when the server
0
8379
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8294
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8494
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8596
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7309
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.