Friday, October 17, 2008

ASP vs. ASP.Net 11

ASP vs. ASP.Net 11

1)What's the .NET equivalent for classic ASP's objRS.MoveNext?
Ans:SQLDataReader.Read() or OleDBDataReader.Read()

2)What happened to date() and time()?
Ans:In ASP.Net you should use:
System.DateTime.Now.ToShortDateString()
and
System.DateTime.Now.ToShortTimeString()

3)Is there a summary of differences from ASP to ASP.Net?
Ans:This page is a starting point.


4)Are there resources online with tips on ASP to ASP.Net conversions?
Ans:
Start here :


5)How do I subtract days from a date and display it?
Ans:
Try:
Dim NewTime as DateTime
NewTime = DateTime.Now.Subtract(New TimeSpan(7, 0, 0))
MyTimeControl.Text = NewTime.ToString()

'You can also format the output with something like:
MyTimeControl.Text = NewTime.ToShortDateString()

6)I'm getting an error trying to read a file from the FileStream.
Ans:
Make sure you are escaping your '\' characters.
Try one of these lines:

objFS = new FileStream("c:\\test.txt", FileMode.Open, FileAccess.Read);
or
objFSt = new FileStream(@"c:\test.txt", FileMode.Open, FileAccess.Read);

7)I want to use a style sheet class directly on a control instead of using inline or page-level format
Ans:
Every WebControl derived control has a CssClass property which allows you to set its format to a style sheet.

8)How should I destroy my objects in ASP.Net?
Ans:
ASP.Net actually has very solid internal garbage collection so this should not be an issue as it was in previous versions of Active Server Pages.

9)Can ASP pages and ASP.Net pages share session variables.
Ans:
Both ASP and ASP.Net support session variables, but the session variables are not shared across the two platforms.

This can be achieved with a third-party utility like StateStitch though.(http://www.consonica.com/solutions/statestitch/index.aspx).

10)Does ASP.Net still recognize the global.asa file?
Ans:
ASP.Net does not recognize the standard ASP global.asa file. Instead it uses a file named global.asax with the same - plus additional - functionality.

11)Can I still run ASP pages on a server that runs ASP.Net?
Ans:
Yes. They will run side-by-side with no adverse affects to the ASP pages at all.

No comments:

Labels

Blog Archive