ASP to ASP.NET

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

Guest

I have an old way of doing this in ASP below..
Can anybody help to change this to ASP.NET..
THannks!!

<script runat="server">
' Insert page code here
Dim l, d, c
'Read in the querystring value
Dim cardtype as String = request.querystring("c")
select case c
case "c"
light_color = "gold"
dark_color = "navy"
cardimage = "d.gif"
case "d"
light_color = "silver"
dark_color = "green"
cardimage = "card.gif"
case "l"
light_color = "#ddffdd"
dark_color = "#339933"
cardimage = "s.gif"
end select

</script>
 
Hi Patrick,

Not really sure exactly what you are trying to do here - if you send us
more details then I'm sure we could all be of more help. The code you've
included doesn't seem to actually do anything! L,d & c as defined (but not
types - are they strings or numbers or booleans etc.). You don't define
cardtype - and then you run a select case on a variable which isn't set to
anything which seems a bit daft.

Also - in ASP.NET you don't really need to pass values from page to page in
the query string. You can use Server.Transfer and access the Context - have
a look at http://www.differentpla.net/node/view/311 for a good example.

But - if I do the job of re-writing your code to do what I think you are
trying to do then I'd presume you'd need something like the following:
sub page_load()
'variable declarations
dim CardType as string
dim Light_Colour as string
dim Dark_Colour as string

select case request.querystring("CardType")
case "c"
light_colour = "gold"
etc.
case "d"

case "t"

end select
end sub

But it sounds like you're doing it quite an unsofisticated way. If I was in
your shoes I might create an order object, define payment types and then use
the built in style object to set the various colour's that you need

Hope this is of some help - but I'm in the dark a bit because it really
isn't clear what you are looking for

Regards,

Nick
 
Sure:

<script runat="server">
' Insert page code here
Dim l, d, c
'Read in the querystring value
Dim cardtype as String = request.querystring("c")
select case c
case "c"
light_color = "gold"
dark_color = "navy"
cardimage = "d.gif"
case "d"
light_color = "silver"
dark_color = "green"
cardimage = "card.gif"
case "l"
light_color = "#ddffdd"
dark_color = "#339933"
cardimage = "s.gif"
end select

</script>

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
Yeah Nick..
I was rushing when i posted out that question!
I didn't expalin myself well! Its ok
Thanks.
Patrick
 
Thx Kevin guess ..
Guess i was stupid:):)


Kevin Spencer said:
Sure:

<script runat="server">
' Insert page code here
Dim l, d, c
'Read in the querystring value
Dim cardtype as String = request.querystring("c")
select case c
case "c"
light_color = "gold"
dark_color = "navy"
cardimage = "d.gif"
case "d"
light_color = "silver"
dark_color = "green"
cardimage = "card.gif"
case "l"
light_color = "#ddffdd"
dark_color = "#339933"
cardimage = "s.gif"
end select

</script>

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
Well, Patrick, I was making a point, but perhaps not clearly enough. The
syntax of VB6, VBScript and VB.Net are not particularly different. In many
cases (such as this one) it requires no tweaking at all. However, the
technology of ASP.Net versus ASP is different as night and day, particularly
in that ASP.Net is object-oriented and ASP is procedural. I just hope you're
re-architecting as well as translating code!

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
Back
Top