Query String : to send information through URL
Response.Redirect("Default3.aspx?val1=ass&val2=" & TextBox1.Text)
The query string cannot be viewed as well as the current page URL will be shown even after the redirection of web page.
Server.Transfer("Default3.aspx?val1=ass&val2=" & TextBox1.Text)
To retrieve information from URL
Response.Write(Request.QueryString("val1") + " " + Request.QueryString("val2"))
Viewstate : syntax
increment of viewstate value which can be saved even after the page postback.
ViewState("cnt") = ViewState("cnt") + 1
Session : syntax
' Check in Page load of a webpage
if textbox1.text= "vamsi" then
Session("username")=textbox1.text
response.redirect("homepage.aspx")
endif
'below code with in homepage.aspx at pageload even
Response.write("Welcome " + Session("username"))
'Checking of user name on each webpage at pageload event
'the below code should check whether the username is hari or not. if its hari its move on to the else part or it will redirect the page which created by the user "errpage.aspx"
' the thing is it may not allow the current page to the unauthorised user
If Session("username") <> "hari" Then
Response.Redirect("errpage.aspx")
Else
Response.Write(Request.QueryString("val1") + " " + Request.QueryString("val2"))
End If
Response.Redirect("Default3.aspx?val1=ass&val2=" & TextBox1.Text)
The query string cannot be viewed as well as the current page URL will be shown even after the redirection of web page.
Server.Transfer("Default3.aspx?val1=ass&val2=" & TextBox1.Text)
To retrieve information from URL
Response.Write(Request.QueryString("val1") + " " + Request.QueryString("val2"))
Viewstate : syntax
increment of viewstate value which can be saved even after the page postback.
ViewState("cnt") = ViewState("cnt") + 1
Session : syntax
' Check in Page load of a webpage
if textbox1.text= "vamsi" then
Session("username")=textbox1.text
response.redirect("homepage.aspx")
endif
'below code with in homepage.aspx at pageload even
Response.write("Welcome " + Session("username"))
'Checking of user name on each webpage at pageload event
'the below code should check whether the username is hari or not. if its hari its move on to the else part or it will redirect the page which created by the user "errpage.aspx"
' the thing is it may not allow the current page to the unauthorised user
If Session("username") <> "hari" Then
Response.Redirect("errpage.aspx")
Else
Response.Write(Request.QueryString("val1") + " " + Request.QueryString("val2"))
End If
No comments:
Post a Comment