**Solved** Custom error page (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


lovduv -> **Solved** Custom error page (2/20/2007 18:30:24)

I used this code to throw an error for a duplicate record


fp_rs.Update
	If err.number <> 0 then
    response.write "<p>That Nick Name is already in use</p>"
    response.end
    Err.Clear
    End If



This works, but it writes back to my form page, how do I get it to write to another page that I design i.e
error.asp
That way I can redirect them back to try again.




lovduv -> RE: Almost solved - Custom error page? (2/21/2007 12:36:57)

Ok now I added this:
fp_rs.Update
	If err.number <> 0 then
    Response.Redirect "error.asp?ID="& NewId
    response.end
    Err.Clear
    End If


This works to redirect when a "duplicate record" error is thrown, but obviously the code:
& NewId
won't work as there is no new record being inserted as it is a duplicate, so how do I show the duplicate entry on the error page?
Normally I would use <%=Request.Querystring("ID")%> but again ID is no good as it is not being inserted. The form field name is Nickname.




lovduv -> RE: Almost solved - Custom error page? (2/21/2007 13:16:55)

I have solved the above with this:

Response.Redirect "error.asp?nickname="& Request("nickname")




lovduv -> RE: Almost solved - Custom error page? (2/21/2007 13:19:19)

I would like to add this but it's not formating the URL correctly any ideas?

You can view <a href='"http://www.nicklistng.aspx?nickname=<%Request.Querystring("nickname")%>"'><%=Request.Querystring("nickname")%>'s Nickname here.</a>




lovduv -> RE: Almost solved - Custom error page? (2/21/2007 13:25:14)

Got it using this!

<a href="nicklisting.aspx?nickname=<%=Request.Querystring("nickname")%>">




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
3.320313E-02