Wed 20 Apr 2011

If you want to have signin as different user functionality like sharepoint in your asp.net application, following workaround you might be looking for.
After setting your web.config file's 

<authentication mode="Windows" />

and in IIS after remove anonymous authentication and enable windows authentication, have following code snippet where you want to have this functionality

In your aspx page

    <div>You are logged in as <br /> <%=User.Identity.Name%> <br /><br /> 
    <asp:LinkButton ID="lnkSignOut" runat="server" Text="Sign in as different user" onclick="lnkSignOut_Click"></asp:LinkButton>


In your code behind file

 protected void Page_Load(object sender, EventArgs e)
{
    if (!this.IsPostBack)
    {
        Session["logOutRequested"] = false; //Initialize value. This will be set to true when user will click on sign in as differnet user
    }
}


protected
void lnkSignOut_Click(object sender, EventArgs e)
{
    if (null != Session["logOutRequested"] && !Convert.ToBoolean(Session["logOutRequested"])) // Check if user is clicking link first time
    {
        Session["logOutRequested"] = true; //Set value that user want to sign in as differnet user
        Response.StatusCode = 401;
        Response.StatusDescription = "Unauthorized";
        Response.End();
    }
    else
    {
        Session["logOutRequested"] = false; //Initialize value again after user is authenticated with differnet or same user again.
    }
}


Hope this workaround will help.

In case if above workaround is not working, you may try following one
www.roelvanlisdonk.nl/?p=825

 

 

 

Tags: , ,
E-mail this post to someone or Comments (1)
Tue 12 Apr 2011

In the world of romance, one single rule applies:
Make the woman happy.

Do something she likes and you get points.
Do something she dislikes and points are subtracted.

You don't get any points for doing something she expects. Sorry, that's the way the game is played.

Here is a guide to the point system:


SIMPLE  DUTIES
You make the bed (+1)
You make the bed, but forget the decorative pillow (0)
You throw the bedspread over rumpled sheets (-1)
You go out to buy her what she wants (+5) in the rain (+8)
But return with beer (-5)
You check out a suspicious noise at night (+1)
You check out a suspicious noise, and it is nothing (0)
You check out a suspicious noise and it is something (+5)
You pummel it with iron rod (+10)
It's her pet (-20)

 
ANNIVERSARY
You take her out to dinner (+2)
You take her out to dinner and it's not a sports bar (+3)
Okay, it's a sports bar (-2)
And it's all-you-can-eat night (-3)
It's a sports bar, it's all-you-can-eat night, and your face is painted the colors of your favorite team (-10)


A  NIGHT  OUT
You take her to a movie (+1)
You take her to a movie she likes (+3)
You take her to a movie you hate (+6)
You take her to a movie you like (-2)
It's called 'Death Cop' (-3)
You lied and said it was a foreign film about orphans (-15)

 
YOUR  PHYSIQUE
You develop a noticeable potbelly (-15)
You develop a noticeable potbelly and exercise to get rid of it (+10)
You develop a noticeable potbelly and resort to baggy jeans and baggy Hawaiian shirts (-30)
You say, "It doesn't matter, you have one too." (-8000)

THE  BIG  QUESTION
She asks, "Do I look fat?" (-5) (Yes, you lose points no matter what)
You hesitate in responding (-10)
You reply, "Where?" (-35)
Any other response  (-20)

COMMUNICATION
When she wants to talk about a problem, you listen, displaying what looks like a concerned expression (0)
You listen, for over 30 minutes (+50)
You listen for more than 30 minutes without looking at the TV (+500)
She realizes this is because you have fallen asleep (-4000)

 

E-mail this post to someone or Comments here