Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

redirect from aspx to asp

Status
Not open for further replies.

durell

Programmer
Feb 4, 2002
12
US
I have an asp page that redirects to aspx and then after processing there is a redirect to another asp page.
Once the aspx finishes processing and tries to ddo the redirect to asp I am receiving an error of "Internet Explorer cannot display the webpage"

Any help resolving this issue woudl be greatly appreciated.
Thanks.
 
Did you trace through your code? If it's just a simple redirect, then there should be no problem. Have you tried in FireFox, it may give you a different, more meaningful error message?
 
It is just a simple "response.redirect "<url>". I have tried a virtural path "/" and the full address (I am an asp developer not asp.net so this is really causing me fits. I have all the code stripped out of the default.aspx except the names spaces and the redirect. If I run the .asp to link to the aspx ..it fails ...if I just run the aspx it will redirect. I have put some response.writes prior to the redirect and then a response.end and the displays show ...so I know the redirect "TO" aspx is working ..it is just the return.
 
Asp code:

response.redirect "session("inbound_email_check") = "done"
response.write("session="&session("inbound_email_check")&"<BR>")
responmse.end


aspx code:

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.Odbc" %>
<%@ Import Namespace="ReadyPOP3" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data.Oledb" %>


<%
Dim strURL As String
strURL = "/development/test.asp"
Response.Redirect(strURL)
%>
<script language="vb" runat="server">
</script>
 
since you are using webforms. you need to understand the webforms life cycle (also referred to as the asp.net page life cycle). this code
Code:
<%
    Dim strURL As String
    strURL = "/development/test.asp"
    Response.Redirect(strURL)
%>
needs to be in a page event, either Init or Load, so it will look something like this
Code:
<script language="vb" runat="server">
<%
public sub Page_Load(sender byval Object, args byval EventArgs) Handles MyPage.Load
    Response.Redirect("/development/test.asp")
end sub
%>
</script>
as a side note: asp.net != webforms. asp.net is a http framework. webforms is an html rendering engine

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Throws an error with the <% .. %> and without them it is throwing an error also "BC30213: Comma or ')' expected
 
Don't put the script in the markup like classic ASP. Put any code in the code-behind page.

In your code behind, put all of your Imports at the top of the page, then in the Page_Load, put:
Code:
 Dim strURL As String
    strURL = "/development/test.asp"
    Response.Redirect(strURL)

This would be the code-behind file:
Code:
Import System.Data
Import System.Data.Odbc
Import ReadyPOP3
Import System.IO
Import System.Data.Oledb

Partial Class YOUR_PAGE_NAME_HERE
    Inherits System.Web.UI.Page
   
   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
      Dim strURL As String
      strURL = "/development/test.asp"
      Response.Redirect(strURL)

    End Sub

End Class
 
like I said I am not an asp.net developer....I have no idea what you mean by the previous message to this. I do appreciate the help...but maybe this is just over my head.
 
try using your favorite search engine to learn the basics of webforms.

another problem you are running into the paradigm shift from traditional web development to the webform model (nothing else like it). the webform model has concepts like statefullness (postback, viewstate), events, binding etc. so the web environment acts more like a desktop environment. for devs coming from desktop development webforms is attractive because
1. the life cycle and events are familiar.
2. you don't need to understand http
3. you don't need to understand html, js or css (bascially the web)

for devs comfortable with web development webforms is a PITA to say the least. the answer to this outlash was an MVC framework for the asp.net framework. with MVC you can control the logic in the controllers the data structure in the model and the html in the view. you also get to choose your html engine and you don't need to deal with events, bindings, page life cycle, postback, view state, etc.

if you do move towards asp.net development I would recommend 1 of 2 mvc frameworks MS MVC or Castle MonoRail. the architecture will be more familiar than webforms.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Thanks for all of your advice on this. I will see if I can get more of the basics down before I jump into this .net thing...yes it is very different from what I am used to working in (ASP).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top