Hi all... Please Explain........
What is the difference between -
1. Page.User.Identity.Name
2. HttpContext.Current.User.Identity.Name.ToString();
3. System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
4.System.Environment.UserName;
-----------
Which statement is to be used in which scenario ??
-------
Please explain.
Please give some links/ examples/ explanation...
I have googled it, but no clear idea till date...
Loading
Riddhi ValechaPosted Mar 19, 2015, 8:27 AM
For Single Sign On,
I am using statement -
"Page.User.Identity.Name" to get the User Name,
Changed the iis setting - Windows Authentication Enabled = true;
-------
My Requirement -
1. I have given a set of users (25 for now), i.e. 25 windows users.
2. My Single Sign On Portal is for these 25 users only.
---------
My Query -
1. I have written the following code on Page_Load event -
if(Page.Ispostback == false )
{
string user = Page.User.Identity.Name.Trim(); //IN//abc.xyz
string checkUser = user.Substring(3).ToString().Trim();//abc.xyz
if (checkUser is present in the database)
{
Response.Redirect("Index.aspx",false);
}
else
{
Response.Redirect ("Errorpage.aspx",false);
}
}
-------
Error-
Sometimes, even if the user is valid, the system redirects to error page.
When I removed the POstBack Condition - then system redirects to Index Page.
Now, Postback will be false on page_load everytime.
It works fine on local. But, it gives error on server.
Please give me some ways to detect issues on server....
--------
How to detect this issue?? What should I do ??
Do I need to use any other thing to implement Single Sign ON
PLease guide and explain...
PradeepPosted Feb 12, 2015, 8:00 AM
basicaly you need to enable
Integrated windows authenticationand the use the following:PradeepPosted Feb 12, 2015, 7:32 AM
for your 1st Point.
Page.User.Identity.Name
this wil check the key value which has been given in the webconfig as given below.
<deny users="me" />
for example if you checking the authentication for page user.