ASP.NET - Redirecting from Classic ASP to .Net aspx page

Asked By rama chandran on 02-Aug-11 05:30 AM
   i am not able to redirect to that classic ASP page, error is coming.

<td align="left">

<asp:LinkButton ID="wlnkProductCode" runat="server" Text='<%#Eval("ProductCode")%>'

OnClientClick="javascript:return OpenProdDetails(this);" Width="100px"></asp:LinkButton>


function OpenProdDetails(id)

{'caf_nonmpg_peg_new.asp?prodid='+id,'skillsWin', 'scrollbars=yes, top=10 , left=10 , resizable=yes');


Jitendra Faye replied to rama chandran on 02-Aug-11 05:33 AM

The aim of the redirect would be to allow a developer to use the features of ASP.NET and use the data from Sage CRM using the SOAP web services which in turn would use the Session ID of the main interface.  You will need to read that earlier article to understand how the session id can be shared.

the Redirect technique in passing so to be explict, here is some example code.

This code shows how a classic COM ASP page could redirect to an ASPX page.

1 <!-- #include file ="sagecrm.js"-->
2 <%
3 Response.Redirect(CRM.URL("test.aspx"));
4 %>

Note:  I tested this by calling the page from the Company context.  The COM method CRM.URL() has been used to add the contextual information and current Session ID to the url for the ASPX page.  

The page redirected and the final URL for the test.aspx page was


The Session ID is available to the ASPX page via the QueryString and the information about company and person context is provided by the Key0 and Key1 name/value pairs

Follow this link-

Reena Jain replied to rama chandran on 02-Aug-11 05:36 AM

try like this

Step 1:  See for detailed instructions on creating a virtual directory for your application.

Step 2:
  Your application’s Bin folder is missing or the application’s DLL file is missing.  See for detailed instructions.

Step 3:
  You may have deployed to the webroot folder, but have not changed some of the settings in the Web.config file.  See for detailed instructions.

Step 4:
  Your application may not have successfully compiled because Visual Studio .NET is caching an old version of the BaseClasses.dll file.  See for details on how to get Visual Studio .NET to use the proper DLL files.

Follow this link also-

Hope this will help you.

Venkat K replied to rama chandran on 02-Aug-11 05:52 AM
rama, Response.Redirect just like Otherwise javascript document.location...
Mitesh Darji replied to rama chandran on 02-Aug-11 06:20 AM
You can redirect page like this:

rama chandran replied to Venkat K on 02-Aug-11 07:31 AM
sorry i want redirect from page to classic page inside javascript
SRE replied to rama chandran on 02-Aug-11 09:41 AM

Two approaches to redirection in ASP.NET

Directing a user to another page or resource is a common aspect of a web application. The user may initiate the transfer to another page any number of ways, including clicking a button or link or selecting a value in a drop-down list.

ASP.NET provides a few ways to move to different pages. Here's a look at these options, along with commentary on when you should use which approach.

Client vs. server

A key aspect of the various ways to send a user to another page within an ASP.NET application is where the transfer occurs; that is, it is handled within the client browser or on the web server. The following list outlines options for controlling page navigation.

  • Response.Redirect: the Redirect method of the Response object provides a way to implement client-side redirection.
  • Server.Transfer: the Transfer method of the Server object performs redirection using the server and avoiding HTTP requests.
  • Server.Execute: the Execute method allows you to call another URL without actually navigating to the page. The page is executed and control returns to the current page when finished.

Let's take a closer look at each approach.

The default behaviour of the Response.Redirect method is execution of the current page halts, and the user is sent to the new URL. The web server issues HTTP headers and sends a 302 response to the client browser; this instructs the client to make redirected calls to the target URL. The result is two server requests for each redirection: the original and redirected requests. The following C# snippet shows it in action:


Now, the Redirect method has two signatures with the second format accepting another Boolean parameter that signals whether execution of the current page should terminate (the default behaviour). We could tell the system to continue execution of the current page while redirecting the user to the site with the following snippet:

Response.Redirect("", false);

The Server.Transfer method transfers the execution of a target URL to the server and halts execution of the current page. The result is only one request (as opposed to the two involved with the Response.Redirect method) since the server does not notify the client browser of the change. The experience can be a little disconcerting for users since the page address does not change in the browser. This C# snippet shows how you may use this method.


When using Server.Transfer, the target URL must be a virtual path on the same server since the web server's worker process is used, so you can't use an address containing "http" or "https". It has three signatures, with a second variation allowing you to transfer control to an IHttpHandler and the third adding a second parameter to the first version; whereas, the second value is a Boolean signalling whether the current form's querystring and Form collections are preserved.

The PreviousPage property of the Page class provides code access to properties of the previous page in the browsing session, so Form and querystring variables are persisted between pages whereas they are not when using Response.Redirect.

The Server.Execute is a bit antiquated, as there are other ways to accomplish the task, but it basically allows you to execute a resource request without leaving the current page. It has five signatures, but the basic version accepts a path to a resource as the following snippet displays:


Pros and cons of each approach

Redirecting a user to another web resource is feasible in ASP.NET using one of the techniques discussed. However, you may be wondering why you would choose one approach over the other. The following list covers some of the advantages or disadvantages of Server.Transfer and Response.Redirect.

  • AJAX usage: the lack of browser interaction with the Server.Transfer method means it may break some AJAX and/or JavaScript functionality.
  • Bookmarking: since Server.Transfer does its work on the server, the address within the client browser is not updated. The user sees the previous page's address while viewing a new page. Consequently, the user is unable to bookmark certain pages.
  • Page refreshes: there is an issue when a true value is used with the second parameter of the Server.Transfer method. When users refresh a page located via this approach, it can trigger an invalid ViewState error message. This can be alleviated by disabling the enableViewStateMac property on a page, but this isn't the best approach to security.
  • Performance: Response.Redirect introduces an extra call while making the round trip between client and server; since there is only one call with Server.Transfer, it offers better performance.
  • Scalability: the extra round trips associated with using Response.Redirect are often stated as a drawback with using it. However, I have seen it used in large applications without experiencing any performance issues.
  • Errors: while Server.Transfer can cause some user confusion as the URL displayed in the browser address bar, it can also lead to some confusion with error logging, as the page URL recorded during logging will display incorrectly.
  • Basic security: an interesting twist with using Server.Transfer is the ability to send data to another page without the user seeing it. This is enabled via the use of the QueryString, which is appended to the end of the target address. This new address will not show in the browser address bar with Server.Transfer, so it offers a simple layer of security. Of course, the Response.Redirect approach makes the QueryString visible to the user.

Usage depends on the situation

ASP.NET offers plenty of options when tackling a development task. The Response.Redirect and Server.Transfer methods provide two ways to redirect users to new URLs. Each method offers its own set of positive attributes, so deciding which one to use is really up to the developer's preference.

SRE replied to rama chandran on 02-Aug-11 09:44 AM
as long as the url is correct, directing the user to the .asp document,
there shouldn't be any real consideration necessary - it's just directing the user to a different page on the website.

Radhika roy replied to rama chandran on 02-Aug-11 10:50 AM

You can redirect the browser to another URL with the Redirect method of the Response object.

If you are going to redirect the user anytime after the <HTML> tag then you need to turn on buffering. On some servers it may be on by default. The statement below turns on buffering.

<% Response.Buffer = True %>

Then you can redirect the browser by doing this.

<% Response.Redirect "whatever_the_page_is_called.asp" %>

So a typical page would look like the following, notice that as the redirect appears in the <body> HTML tag we need to have buffering turn on.

<% Option Explicit %>
<% response.buffer=true %>

<title>redirect page</title>



You can place different redirects within (if/else) statements or you can also use variables as in the example below.


<% Option Explicit %>
<% response.buffer=true %>

<title>redirect page</title>

'declare your variable
Dim Page
Page = "mainpage.asp" 
Response.Redirect (Page)


Hope this will help you.