Back to list
Views:   8.6K
Replies:  1
Archived

Question on DPF ActionService ValidRequest method

I'm going through the ActionService WCF service, specifically the ValidRequest method and saw that the section that validates the ClientTag was commented with:

// Validate Client Tag. 
// Hardcoded here. In production this should query a 'client' table in a database.
if ((Validate.ClientTag & validate) == Validate.ClientTag)
{
  if (request.ClientTag != "ABC123")
  {
    response.Acknowledge = AcknowledgeType.Failure;
    response.Message = "Unknown Client Tag";
    return false;
  }
}
Could you expand on how that might be implemented?  I'm trying to work this into a project of mine and wanted to see how a production application would employ this.

Doug
 
Doug Rohm, Dec 29, 2010
Reply 1
Hi Doug,

Happy New Year!

The "ABC123" value in this case can be in a Settings table in the database as a value for a setting called "ClientTag".  The Settings table might be just a table with two columns (and a rowversion column), called "Name" and "Value".  This can be a table with general collection of settings that can be collected in name/value pairs.

So in this table you can have something like the following:
  • Name = "SiteName", Value = "My Cool Website"
  • Name = "ClientTag", Value = "HJ6Ev6qNMtL?XnHXmGRl1VE@"
  • etc

Then you can simply replace the "ABC123" string with a call to your service or repository that retrieves this value.

I hope this answers your question.

King Wilder
if ((Validate.ClientTag & validate) == Validate.ClientTag)
{
  var setting = settingsDao.GetAll()
     .Where(s => s.Name == "ClientTag").SingleOrDefault();
     
  if (request.ClientTag != setting.Value)
  {
    response.Acknowledge = AcknowledgeType.Failure;
    response.Message = "Unknown Client Tag";
    return false;
  }
}

 
King Wilder, Jan 01, 2011
Is there an example showing MVC 2 in v3.5?
Sep 09, 2010


Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas.      Vsn 1.3.0