Reputation: 1470
I have three ASPX Pages. The ASPX Page which get called from the two other Page is a Page where i can Upload files.
I call that Upload-Page from the other two Pages with JavaScript:
function UploadFax_Click() {
var grid = ISGetObject("WebGrid1");
var curSelObj = grid.GetSelectedObject(); // get selected object
var row = curSelObj.GetRowObject(); // get the WebGridRow object
if (row.Type == "Record") {
var s_id = row.KeyValue
}
window.location = '../Admin/UploadFax.aspx?suppid=' + s_id;
}
Then on the Upload-Page i get the QueryString:
If Not IsPostBack And Len(Request.QueryString("suppid")) > 0 Then
If Not Request.QueryString("suppid") Is Nothing Then
Session("suppid") = Request.QueryString("suppid")
End If
End If
What i need is that if i call the Upload-Page from one of the two Pages the functions of the Upload-Page should be restricted. For Example: If i call the Upload-Page then Checkbox.Disabled = true and from the other page Checkbox should be enabled.
My idea was to send a second parameter from that page, then get the parameter with Request.QueryString and then use if/else to enable oder disable that checkbox.
Question is, is there another, better possibility to do that what i want? If yes how can i do that?
Upvotes: 0
Views: 170
Reputation: 9084
Using QueryString
may cause a security violation , Why not you use Session
parameter,
when you Call it from the First Page then set
Session("IsCalled")="1"
in the second page load check
IF Not Session("IsCalled") Is Nothing AndAlso Session("IsCalled")="1" Then
CheckBox1.Enabled=False
End If
and Vise Versa in the first page load.
Upvotes: 1
Reputation: 5128
You can check the Request.UrlReferrer
and dance from it:
Dim restrictedAccess As Boolean = Not IsNothing(Request.UrlReferrer) AndAlso
Request.UrlReferrer.AbsolutePath.IndexOf("/Original.aspx", StringComparison.InvariantCultureIgnoreCase) >= 0
Checkbox.Disabled = Not restrictedAccess
Upvotes: 1