Click here to Skip to main content
15,888,610 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionActive directory & .net Pin
samerh29-Mar-07 21:05
samerh29-Mar-07 21:05 
AnswerRe: Active directory & .net Pin
Colin Angus Mackay29-Mar-07 21:11
Colin Angus Mackay29-Mar-07 21:11 
GeneralRe: Active directory & .net Pin
samerh29-Mar-07 21:15
samerh29-Mar-07 21:15 
GeneralRe: Active directory & .net Pin
Colin Angus Mackay29-Mar-07 22:12
Colin Angus Mackay29-Mar-07 22:12 
Questionhyperlink lables Pin
Raheem MA29-Mar-07 20:53
Raheem MA29-Mar-07 20:53 
AnswerRe: hyperlink lables Pin
Kunal P29-Mar-07 21:23
Kunal P29-Mar-07 21:23 
QuestionProblem with sending mail. Pin
anujose29-Mar-07 20:53
anujose29-Mar-07 20:53 
QuestionCustom principal "replaced" by GenericPrincipal Pin
EnkelIk29-Mar-07 20:51
EnkelIk29-Mar-07 20:51 
Hi all!

I just converted a .net 1.1 web project to .net 2.0 and now I'm getting a strange problem:

I have a custom class implementing IPrincipal to store the user identity in Context.User, sample code below. After storing the Principal i redirect from the login-page. When I retrieve the Context.User on the next page it is of type GenericPrincipal????? The user information is still there but of course not with my custom methods. I guess I could rewrite the code to use GenericPrinfipal instead, but why does this happen??? It did not happen before the conversion (and as far as I can think of I didn't make any other changes to the code).

I use Forms-authentication (using Windows authentication gives me the WindowsPrincipal when retrieving Context.User - i.e. the useridentity of the useraccount running the app, not of the user logged in to the web app).

I feel there has to be a logical explanation for this and I am grateful for any help!

Thanks!


/*******************************/

CustPrincipal newUser = CustPrincipal.ValidateLogin(TxtUsername.Text, TxtPassword.Text);

// Create the authentication ticket
FormsAuthenticationTicket authTicket = newUser.GetAuthenticationTicket();

// Now encrypt the ticket.
string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
// Create a cookie and add the encrypted ticket to the
// cookie as data.
HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName,
encryptedTicket);
// Add the cookie to the outgoing cookies collection.
Response.Cookies.Add(authCookie);

// Add user to context
Context.User = newUser;
System.Threading.Thread.CurrentPrincipal = newUser;

/********************************/

AnswerRe: Custom principal "replaced" by GenericPrincipal Pin
Tim-Nape22-Oct-13 4:51
Tim-Nape22-Oct-13 4:51 
QuestionDropdownlist Pin
samsonx29-Mar-07 20:50
samsonx29-Mar-07 20:50 
AnswerRe: Dropdownlist Pin
_AK_29-Mar-07 21:41
_AK_29-Mar-07 21:41 
AnswerRe: Dropdownlist Pin
MinhajuddinK30-Mar-07 7:58
MinhajuddinK30-Mar-07 7:58 
QuestionUpload File Pin
vengaqua29-Mar-07 20:39
vengaqua29-Mar-07 20:39 
AnswerRe: Upload File Pin
nyogeswar29-Mar-07 20:45
nyogeswar29-Mar-07 20:45 
GeneralRe: Upload File Pin
vengaqua29-Mar-07 21:00
vengaqua29-Mar-07 21:00 
AnswerRe: Upload File Pin
Venkatesh Mookkan29-Mar-07 20:48
Venkatesh Mookkan29-Mar-07 20:48 
GeneralRe: Upload File Pin
vengaqua29-Mar-07 20:59
vengaqua29-Mar-07 20:59 
GeneralRe: Upload File Pin
vengaqua29-Mar-07 21:07
vengaqua29-Mar-07 21:07 
GeneralRe: Upload File Pin
vengaqua29-Mar-07 21:13
vengaqua29-Mar-07 21:13 
Questionwhat is the bestway to fill a grid if one lakh record is there in database Pin
anujose29-Mar-07 20:34
anujose29-Mar-07 20:34 
AnswerRe: what is the bestway to fill a grid if one lakh record is there in database Pin
_AK_29-Mar-07 21:07
_AK_29-Mar-07 21:07 
AnswerRe: what is the bestway to fill a grid if one lakh record is there in database Pin
Kunal P29-Mar-07 21:26
Kunal P29-Mar-07 21:26 
AnswerRe: what is the bestway to fill a grid if one lakh record is there in database Pin
MinhajuddinK30-Mar-07 7:52
MinhajuddinK30-Mar-07 7:52 
Questioncall child page jscript function from parent page in ASP Pin
RK_Tamil29-Mar-07 20:33
RK_Tamil29-Mar-07 20:33 
Questionsession VS query string Pin
firestoper29-Mar-07 20:26
firestoper29-Mar-07 20:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.