VAB config file changes not affecting validation

Topics: Enterprise Library Core, General discussion, Validation Application Block
Aug 15, 2007 at 6:15 PM
Hello,

I have created a configuration source section of my web.config file. The code is below:

<enterpriseLibrary.ConfigurationSource selectedSource="validation">
<sources>
<add name="validation" type="....FileConfigurationSource, ....Common, Version=3.1......"
filePath="validation.config" />
</sources>
</enterpriseLibrary.ConfigurationSource>

Inside validation.config I have:
<configuration>
<configSections>
<section name="validation" type="....ValidationSettings, ...Validation, Version=3.1.0.0......"/>
</configSections>
<validation>
My validation rules here
</validation>
</configuration>

When I make changes to validation.config and upload those changes to the server, my changes don't take affect right away. I had the validation code in the web.config file originally, but needed to move it out to its own config file. When it was in the web.config file, changes were seen immediatly.

Is there a way to make my changes to the validation.config file effective as soon as I upload it to the server (the same way that the web.config file was working)? How would I go about doing this?

Thanks
Aug 15, 2007 at 6:50 PM
Hi,
.
When you changed the web.config the application was restarted, so it was a new instance picking up the fresh changes.

The validation application block will cache the validators, so if you change the configuration after it has been read by the block the changes will unfortunately not be picked up until you invoke the static method ValidationFactory.ResetCaches() from within the application or restart it.

Regards,
Fernando
Aug 15, 2007 at 7:57 PM
Hi,

I tried to call validationFactory.ResetCaches from a button on my asp.net page, but the validation rules don't get updated on the server.

I would prefer not to restart the application every time I change the validation rules

Any idea why the ResetCaches isn't working?

Thanks
Aug 15, 2007 at 8:23 PM
Hey,

I think this might be an issue of saving the configuration and/or uploading the configuration. Sometimes it works fine, other times it doesn't. I will play around with this more and if I get more information, I will post it here.

Thanks for your help
curlypinhead
Aug 16, 2007 at 12:45 PM
Hi,

Configuration should be refreshed after a change in the configuration file's timestamp is detected. It can take up to 20 seconds to detect the change, and the timestamp must be properly updated.

Can this explain the behavior you see?

Regards,
Fernando
Aug 20, 2007 at 9:08 PM
Thanks,

Yes, that explains the behavior

curlypinhead