Jump to content

.net query string help


dev
 Share

Recommended Posts

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

<%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

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

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...