In your JS code write you can write the following literal declaration into a JS variable.
var data = “<asp:Literal runat=”server” Text=”<%$Resources:myresourcefile,resourcetitle%>” />”;
Then you can use the value in the data variable to lets say hide something in your page based on a translation. In the following example I hid a certain breadcrumb information based on different languages.
$(“#breadcrumb ul li a:contains(” + code + “)”).hide();
If you are planning to make a table constraint that is more complex than a simple check against a field or two then I recommend using functions. By creating a function you can make complex logic by which you can return True Or False states that indicate to a constraint if the data is what you need it to be. You can also add parameters to a function giving you the dynamic possibility to process data being processed.
Lets say that you have function that wants to check if a ID value is a certain numeric ID and then you want to make sure that a row being inserted does not have a NULL value in a certain field.
Here is some sample code:
CREATE FUNCTION [dbo].[CheckForNullByID]
— Add the parameters for the function here
DECLARE @retValue bit = 0
IF @someID = 40
IF @someFieldNotNULL IS NOT NULL
SET @retValue = 1
SET @retValue = 0
SET @retValue = 1
Then you call the function in your constraint like the following expression:
Thats it :)!!!
Hope this helps 🙂
Part 2 of the good to know things of Windows Server 2012:
Here are some tips on how to allow your web application to change passwords to Active Directory. There are several ways which all work in a similar but different way. This is one of them and what you need to take into consideration.
Here I will concentrate in the code logic and configurations what you need to take and do.
These are the following steps you need to take:
1. Create a web form for you password reset
2. Create a account with just enough privileges to set or reset user passwords
3. Impersonate this account and reset or set a new password under this password “admin” account
And a small sample code on how to change a password:
using (var context = new PrincipalContext(ContextType.Domain, “domain”, “username”, “password”))
using (var user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, “username whose password to change”))