asp to asp.net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In asp I could redirect to a page with a named/value pair ("www.foo.com/home.asp?error=101"
Inside of the asp I could add the following code to trap for any errors
<
s_error = CStr(request("error")
if s_error <> "" the
s_error_messag
select case s_erro
case "101
s_error_message = "User Not Found.
%><table><tr><td><%=(s_error_message)%></td></td></table><
end selec
end i
%

how do I do this in .asp
here's what I've attempted (again, very new to this)

<script language="C#" runat=server
string s_err_message;
if (Request("error") != ""

switch Request("error"

case "101"
s_err_message = "login not found";

</script><TABLE id="tblAlert" align="center" cellSpacing="1" cellPadding="1" width="100%" height="50" border="0" bgcolor="red"><TR><TD colspan="3"><script>s_error_message</script><TD></TR></TABLE><script

</script

I know it doesn't work, but am I even close? Did the <%%> go away? Is it difficult to intermingle variables and static text
Any articles to read on this very topic would be appreciated as well

Thanks
 
Here is a link to help you get started.

http://asp.net/Tutorials/quickstart.aspx

Here is some code that should work the way you want. But I would highly
recommend looking at splitting your content and code into seperate files.
(codebehind files)

<script runat="server" language="c#">
void Page_Load( object s, EventArgs e )
{
_ErrorMessage = "";
string s = Request.QueryString["Error"];
if ( s != null )
{
switch( s ) {
case "101":
_ErrorMessage = "User Not Found";
break;
}
}
}
string _ErrorMessage;
<script>

<TABLE id="tblAlert" align="center" cellSpacing="1" cellPadding="1"
width="100%" height="50" border="0" bgcolor="red"><TR><TD colspan="3"><%
=_ErrorMessage %> <TD></TR></TABLE>


McGuyver said:
In asp I could redirect to a page with a named/value pair ("www.foo.com/home.asp?error=101")
Inside of the asp I could add the following code to trap for any errors:
<%
s_error = CStr(request("error"))
if s_error <> "" then
s_error_message
select case s_error
case "101"
s_error_message = "User Not Found."
%><table><tr><td><%=(s_error_message)%></td></td></table><%
end select
end if
%>

how do I do this in .asp?
here's what I've attempted (again, very new to this):

<script language="C#" runat=server>
string s_err_message;
if (Request("error") != "")
{
switch Request("error")
{
case "101":
s_err_message = "login not found";
}
</script><TABLE id="tblAlert" align="center" cellSpacing="1"
cellPadding="1" width="100%" height="50" border="0" bgcolor="red"> said:
}
</script>

I know it doesn't work, but am I even close? Did the <%%> go away? Is it
difficult to intermingle variables and static text?
 
ASP.Net is much, much more powerful and complex than ASP. Rather than
playing guessing games, which could sometimes work within the tiny framework
of ASP scripting, I would suggest studying ASP.Net thoroughly before trying
your hand at coding it.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

McGuyver said:
In asp I could redirect to a page with a named/value pair ("www.foo.com/home.asp?error=101")
Inside of the asp I could add the following code to trap for any errors:
<%
s_error = CStr(request("error"))
if s_error <> "" then
s_error_message
select case s_error
case "101"
s_error_message = "User Not Found."
%><table><tr><td><%=(s_error_message)%></td></td></table><%
end select
end if
%>

how do I do this in .asp?
here's what I've attempted (again, very new to this):

<script language="C#" runat=server>
string s_err_message;
if (Request("error") != "")
{
switch Request("error")
{
case "101":
s_err_message = "login not found";
}
</script><TABLE id="tblAlert" align="center" cellSpacing="1"
cellPadding="1" width="100%" height="50" border="0" bgcolor="red"> said:
}
</script>

I know it doesn't work, but am I even close? Did the <%%> go away? Is it
difficult to intermingle variables and static text?
 
BTW, the .Net SDK is a free download, and it contains a whole lot of free
help:

http://www.microsoft.com/downloads/...A6-3647-4070-9F41-A333C6B9181D&displaylang=en

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.


McGuyver said:
In asp I could redirect to a page with a named/value pair ("www.foo.com/home.asp?error=101")
Inside of the asp I could add the following code to trap for any errors:
<%
s_error = CStr(request("error"))
if s_error <> "" then
s_error_message
select case s_error
case "101"
s_error_message = "User Not Found."
%><table><tr><td><%=(s_error_message)%></td></td></table><%
end select
end if
%>

how do I do this in .asp?
here's what I've attempted (again, very new to this):

<script language="C#" runat=server>
string s_err_message;
if (Request("error") != "")
{
switch Request("error")
{
case "101":
s_err_message = "login not found";
}
</script><TABLE id="tblAlert" align="center" cellSpacing="1"
cellPadding="1" width="100%" height="50" border="0" bgcolor="red"> said:
}
</script>

I know it doesn't work, but am I even close? Did the <%%> go away? Is it
difficult to intermingle variables and static text?
 
Back
Top