dev Posted June 6, 2006 Share Posted June 6, 2006 hello,I'am new to asp.net and very much querious to built aspx page. Please help me with this. Request to my seniors to help me converting this asp code to .net---------------------<%Dim StrPageStrPage = Request ("StrPage")if StrPage = "on" then %><!--#include file = "anything.asp" --><% end ifif StrPage = "off" then %><!--#include file = "anything.asp" --><% end if %>---------------------With thanks,dev Link to comment Share on other sites More sharing options...
aspnetguy Posted June 6, 2006 Share Posted June 6, 2006 <%Dim StrPage As StringStrPage = Request.QueryString ("StrPage")If StrPage = "on" Then %><!--#include file = "anything.asp" --><% End IfIf StrPage = "off" Then %><!--#include file = "anything.asp" --><% End If %> that should do it.As much as I cringe at seeing .net code written this way...it will work.There is very little benefit in using ASP.Net if you are going to continue coding just like ASP.It is recommended that SSI not be used in ASP.Net. ASP.Net makes using classes and objects very easy and they can handle this process more efficiently Link to comment Share on other sites More sharing options...
dev Posted June 6, 2006 Author Share Posted June 6, 2006 Thank you very much aspnetguy I saved these codes as aspx but its giving me parser error with asp include file. anyway i want to left asp a side and want to learn asp.net. i am having framework 2 installed and like .net 2. i have no idea also about asp.net 1.1. i've just unabled asp.net 2 on my server.Please give me an example to use class and objects in referrance with that asp codes.waiting...Sincerely,dev Link to comment Share on other sites More sharing options...
aspnetguy Posted June 6, 2006 Share Posted June 6, 2006 The reason you're getting hte error is because hte include files themselves are .asp. You cannot run ASP with ASP.Net. The names are similar but hte compilers are completely different.You should read through the ASP.Net tutorial first at www.w3schools.coom Link to comment Share on other sites More sharing options...
dev Posted June 6, 2006 Author Share Posted June 6, 2006 Ok i will follow your instructionsthank you very much for your assistance ,dev Link to comment Share on other sites More sharing options...
dev Posted June 7, 2006 Author Share Posted June 7, 2006 hi, i am here again...i went through all the documentations and it gave me lots of ideas on creating my first .net page. now i know the better way to include other .net files to a specific page. but i still can not figure out how asp.net uses request.querystring("") attribute. i am very fond of using this attribute in asp and want to use it with asp.net too.it says asp.net can handle this attribute with more flaxibility. i will be very thankfull if you create me the code. i am too new to understand and modify it as my needs. please translate this codes in asp.net. i want to include specific files using query string.---------------------<%Dim StrPageStrPage = Request ("StrPage")if StrPage = "on" then %><!--#include file = "anything.asp" --><% end ifif StrPage = "off" then Strtext="No page to view" %><% end if %>---------------------Thankfull to you,dev Link to comment Share on other sites More sharing options...
pulpfiction Posted June 7, 2006 Share Posted June 7, 2006 I guess aspnetguy has already done that for you.....<%Dim StrPage As StringStrPage = Request.QueryString ("StrPage")If StrPage = "on" Then %><!--#include file = "anything.asp" --><% End IfIf StrPage = "off" Then %><!--#include file = "anything.asp" --><% End If %> Link to comment Share on other sites More sharing options...
aspnetguy Posted June 7, 2006 Share Posted June 7, 2006 here is one way to do it. ...<body><script language="vb">Dim StrPage As StringStrPage = Request.QueryString("StrPage")Dim sr As StreamReaderIf StrPage = "on" Then sr = File.OpenText("YourFile.aspx") lblInclude.Text = sr.ReadToEnd() sr.Close()End IfIf StrPage = "off" Then sr = File.OpenText("AnotherFile.aspx") lblInclude.Text = sr.ReadToEnd() sr.Close() End If</script><form runat="server">some content....<!--PLACE FOR INCLUDE FILE--><asp:Label id="lblInclude" runat="server"/>some more content....</form></body></html> Link to comment Share on other sites More sharing options...
dev Posted June 7, 2006 Author Share Posted June 7, 2006 Thanks pulpfiction,sorry if its annoyenting, but i wanted to use asp.net code but not old asp code.with thanks,dev Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now