Quote:
Originally Posted by chroniclemaster1
I think you're making it more complicated than it needs to be. Just use an appropriate Request.Url object (I think there are shorter ones than AbsolutePath, but whatever works for you.) Store that in your database, and use it in your WHERE statement just like you're doing. I haven't tried doing it, but the only bumps I can see is that if you have slashes and punctuation you might need to escape them.
|
Thanks for the response.
However, you assume a greater knowledge on my part than I actually possess :(
I am VERY MUCH a beginner learning 'on project'.
I have tried to look up the use of request.url. and it looks like I can use .segments??? to get the page name :
To test my theory I created a test page (aaTestingpage.aspx) with a label and put the following code in the code behind page:
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim WebPage As String = Request.Url.Segments.Clone / Page.ToString
Label1.Text = WebPage
End Sub
When I run the page I get the error:
Operator '/' is not defined for type 'String()' and string "ASP.aatestingpage_aspx".
If I use Request.Url.Segments.Clone.Page.ToString
I get:
Public member 'Page' on type 'String()' not found
Obviously, you can see that I am 'fishing' without solid knowledge.
Assuming I can get this syntax right with someone's help(!), Where would I put it so that the variable WebPage is available on every page and contains the name of the current page. In the code behind of the Masterpage? Or do I need to create a Base page and link all my pages to it?
And do I refer to it in my SELECT statement as WHERE PageName = '" & WebPage & "' or do I need to set something else up?
Appreciate the patience of all on the forum .