Jump to content
Sign in to follow this  
dev

.net query string help

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Ok i will follow your instructionsthank you very much for your assistance :) ,dev

Share this post


Link to post
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

Share this post


Link to post
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 %>

Share this post


Link to post
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>

Share this post


Link to post
Share on other sites

Thanks pulpfiction,sorry if its annoyenting, but i wanted to use asp.net code but not old asp code.with thanks,dev

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...