Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Need to check usage and user roles....Need to check usage and user roles....
Previous
 
Next
New Post
12/31/2009 6:41 AM
 

Hello

Can anyone help me please?

I run a taxi fare calculator website and I want to put in place some code that stops the calculator being used more than 5 times if the user is not a member of a particular member role.

I have written and tested this on my dev server and it works perfectly. BUT when I upload it to the live site it doesnt work...

Can anyone think why this would be? I have made 100% sure the names of the roles are identical on the dev machine as the live machine....

Here is the code. Can anyone help me find out why it wont work on the live site please?

Thanks, Trev

 

'Return the number of times this person has used the calculator

 

'Get the ip address of the user

 

 

Dim IPAddress As String = Request.UserHostAddress.ToString'Run a query to find out how many times this ip address has used the calculator

 

 

Dim IPQueries As DataSet = TaxiRoute.DataProvider.Instance.GetNumberOfEnquiriesByIPAddress(IPAddress)'If the ip address has been used before, how many times?

 

If IPQueries.Tables(0).Rows.Count <> 0 Then 'if this is the first time then there will be no records returned from the sp

 

'The number of enquiries is needed as an integer for later use.. it's in the table at 0,1

 

 

Dim CountOfEnquiries As Integer = IPQueries.Tables(0).Rows(0).ItemArray(1)'Now find out what roles, if any, the user is member of

 

 

 

 

Dim mRoles As New DotNetNuke.Entities.Users.OnlineUserInfoDim mUserRoles As New DotNetNuke.Security.Roles.RoleControllerDim mUser As DotNetNuke.Entities.Users.UserInfo = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo'Setup a flag to carry authorisation state with a default of false

 

Dim Authorised As Boolean = False

 

'Traverse through roles to see if they are in an authorised role

 

 

For Each i As String In mUserRoles.GetRolesByUser(mUser.UserID, mRoles.PortalID)If i.ToString() = "Silver Package Taxi Companies Monthly Subscription" Or i.ToString() = "Silver Package Taxi Companies Yearly Subscription" Then

Authorised =

True

 

End If

 

 

Next

 

'Check the users role and the number of enquiries and disable if wrong

 

If CountOfEnquiries > 5 And Authorised = False Then 'if they have done more than 5 queries and are not a silver member then disable.

ButtonGetRoute.Enabled =

False

LabelRouteMessage.Text =

"You have exceeded your daily allowance of enquiries. You must be logged in as a Silver Member to be able to make more than 5 enquiries a day."

 

End If

 

End If


www.taxiroute.co.uk - Get a Fare Price!
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Need to check usage and user roles....Need to check usage and user roles....


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out