I’m not quite sure how to explain this, but I need to be able to add a user’s code to the end of the url of each page they go to.
Let me walk you through this…..I am a user, go to my site and type in my user code – which is NOT a login. There is no password, in theory there will be a box or some type of control that will allow a user to enter their code in.
This control will then add that user’s code to the end of each URL for every page in the site and will also auto-populate all of the products in our database that are tied to that code.
The user is like a business or affiliate marketer. We need that code at the end of each URL that way when he sends his clients emails with links in them for purchasing, the client will click the link, and that marketer will get credit for the sale(s).
If this makes sense, will someone direct me to a helpful tutorial or explain how this works to me please? Thank you
I was told to use this code:
<ul id="p7menubar">
<li><a href="<% =GetIB("http://products.pfgbest.com") %>">Home</a></li>
<li><a href="#" class="trigger">Lookup</a>
<ul>
<li><a href="<% =GetIB("Default.aspx") %>">Product</a></li>
<li><a href="<% =GetIB("/FeatureSearch.aspx") %>">Feature</a></li>
<li><a href="<% =GetIB("/DescriptionSearch.aspx") %>">Description</a></li>
</ul>
</li><!--end trigger li-->
<div id="ib">
Enter your IB code here:
<asp:TextBox ID="IBTextBox" runat="server"></asp:TextBox>
<asp:Button ID="IBTextBoxButton" runat="server" Text="Submit" />
</div>
</ul><!--end p7menubar-->
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Private _IB As String
Public Property IB() As String
Get
Return _IB
End Get
Set(ByVal value As String)
_IB = value
End Set
End Property
Public Function GetIB(ByVal url As String) As String
If (url.Contains("?")) Then
Return "&IB=" & _IB
Else
Return url & "?IB=" & _IB
End If
End Function
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not (String.IsNullOrEmpty(Request.QueryString("IB"))) Then
_IB = Request.QueryString("IB")
End If
End Sub
End Class
UPDATE: With the help of @DJ Quimby and ASP.net 3.5 for Dummies, I am now using this code and it seems to be taking it whatever value I type into my textbox:
Protected Sub IBTextBoxButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles IBTextBoxButton.Click
Session("IB") = IBTextBox.Text
Dim IB As Integer = Session("IB")
Response.Redirect("IBDefault.aspx?Baccount=" + Session("IB"))
End Sub
UPDATE:
<a target="_blank" href="<%# eval("Data") %>?IB=(Session("IB"))"><%#Eval("Title")%></a>
The “IB” gets underlined and says it must be followed by an equal (=) sign and a value. Or if in quotation marks, they must match.
Unless there are any private data concerns, it may be best to store the user’s code into session.
You can add most any variable you want to the session by doing the following:
Session(“userCode”) = “12”
And retrieve it like this:
‘Dim userCode as Integer’
‘userCode = Session(“userCode”)’
Just make sure that the type you store it as is compatible with the type you assign it to when you pull it back down.
To check on each page you could declare a private variable within the page to store the value:
Private userCode As IntegerAnd then
Sub Page_Load(sender As Object, e As EventArgs)userCode = Session("userCode")End SubThen just execute whatever other code you need to using that value.