Tuesday, May 10, 2011

What is site minder ? what is use of siteminder?

It seems to be another 2nd party helper for security and ease of protecting important information.
SiteMinder provides policy-based authentication as well as single sign-on for all Web-based applications. SiteMinder is used in conjunction with IdentityMinder, which manages detailed user profiles, and TransactionMinder, which provides access to Web services.
I am guessing this would be used for a dataCenter or a Webhosting or ISP company, never seen it in action mind you.
Please help me out if anybody has any idea.

The Two Interceptors: HttpModule and HttpHandlers

Many times we want to implement pre-processing logic before a request hits the IIS resources. For instance you would like to apply security mechanism, URL rewriting, filter something in the request, etc. ASP.NET has provided two types of interception HttpModule and HttpHandler.

HttpHandler – The Extension Based Preprocessor

HttpHandler help us to inject pre-processing logic based on the extension of the file name requested. So when a page is requested, HttpHandler executes on the base of extension file names and on the base of verbs. We can also map one handler to multiple file extensions. For instance, when any client requests for file with extension ‘GIF’ and ‘JPEG’, handler3 pre-processing logic executes.

HttpModule – The Event Based Preprocessor

HttpModule is an event based methodology to inject pre-processing logic before any resource is requested. When any client sends a request for a resource, the request pipeline emits a lot of events.
Below is a detailed explanation of the events.
  • BeginRequest: Request has been started. If you need to do something at the beginning of a request (for example, display advertisement banners at the top of each page), synchronize this event.
  • AuthenticateRequest: If you want to plug in your own custom authentication scheme (for example, look up a user against a database to validate the password), build a module that synchronizes this event and authenticates the user in a way that you want to.
  • AuthorizeRequest: This event is used internally to implement authorization mechanisms (for example, to store your access control lists (ACLs) in a database rather than in the file system). Although you can override this event, there are not many good reasons to do so.
  • PreRequestHandlerExecute: This event occurs before the HTTP handler is executed.
  • PostRequestHandlerExecute: This event occurs after the HTTP handler is executed.
  • EndRequest: Request has been completed. You may want to build a debugging module that gathers information throughout the request and then writes the information to the page.
We can register these events with the HttpModules. So when the request pipe line executes depending on the event registered, the logic from the modules is processed.

Javascript | Calender

http://www.javascriptkit.com/script/script2/tengcalendar.shtml

Javascript | Clipboard

<html>
<head>
<title>Clipboard</title>
<script type=”text/javascript” language=”javascript”>
function SetClipBoard()
{
var email = document.getElementById(‘txtEmail’);
var emailValue = email.value;
window.clipboardData.setData(‘Text’ , emailValue );
}
function GetClipBoard()
{
var emailText = window.clipboardData.getData(‘Text’);
alert(emailText);
}
function ClearClipBoard()
{
window.clipboardData.clearData();
}
</script>
</head>
<body>
<form onreset=”return confirm(‘Do you want to reset the form?’)”>
<textarea name=”txtEmail” id=”txtEmail” rows=”4″ cols=”20″>Default Text</textarea>
<button onclick=”SetClipBoard();”>
Copy to Clipboard</button>
<button onclick=”GetClipBoard();”>
Get Clipboard Data</button>
<button onclick=”ClearClipBoard();”>
Clear Clipboard</button>
<input type=”reset” />
</form>
</body>
</html>

Javascript – Getting drop down values

<select id="ddlViewBy">
<option value="1">test1</option>
<option value="2" selected="selected">test2</option>
<option value="3">test3</option>
</select>

var e = document.getElementById("ddlViewBy");
var strUser = e.options[e.selectedIndex].value;

var e = document.getElementById("ddlViewBy");
var strUser = e.options[e.selectedIndex].text;

JavaScript – Persist state of page using Hidden field

function showHide(divId,ImgId)
{
divstyle = document.getElementById(divId).style.display;
Image_ID=document.getElementById(ImgId);
if(divstyle.toLowerCase()==”block” &&  document.getElementById(‘<%=hdnShowHide.ClientID %>’).value==”0″)
{
document.getElementById(‘<%=hdnShowHide.ClientID %>’).value=”1″;
Hide();
}
else
{
document.getElementById(divId).style.display=”block”;
Image_ID.src=”/Images/uparrows_white.gif”;
document.getElementById(‘<%=hdnShowHide.ClientID %>’).value=”0″;
}
}
function Hide()
{
Image_ID=document.getElementById(‘img2′);
if(document.getElementById(‘<%=hdnShowHide.ClientID %>’).value==”1″)
{
Image_ID.src=”/Images/downarrows_white.gif”;
document.getElementById(‘divSearchCriteria’).style.display=”none”;
}
}
<asp:HiddenField ID=”hdnShowHide” runat=”server” Value=”0″ />
For user control:
At end of control’s HTML:
<script type=”text/javascript”>
Hide();
</script>
For page using content of master:
Use below code in script after hide function:
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != ‘function’) {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(Hide);

JavaScript – window.close() isn’t working in mozilla firefox

Use the following code instead of “window.close();”
function winClose(){ window.top.opener = null; window.close(); }
or
function   closeWindow()   {    window.open(”,’_parent’,”);   window.close(); }
If it doesn’t works
Please set your firefox browser:
1.input “about:config ” to your firefox address bar and enter;
2.make sure your “dom.allow_scripts_to_close_windows” is true