This topic is locked
[SOLVED]

 UserID blank with AD integration

6/7/2019 4:08:01 PM
ASPRunner.NET General questions
T
Tim author

I use Active Directory integration, IIS auto login and dynamic permissions. I have a link that sends users to an add page:
http://mydomain.com/trainings/StaffTrainingSurvey/add?t=635'>http://mydomain.com/trainings/StaffTrainingSurvey/add?t=635
but it appears that XSession.Session["UserID"] is blank when I send them directly to this add page. If they go to the root of the app (i.e. http://mydomain.com/trainings) and then click the link to go to the add page, this session is populated.
Also, all authenticated users have access to this add page, but guests and default is no access, though they are able to load and save the add page even though the UserID session is blank.
Shouldn't the XSession.Session["UserID"] always be populated? And when going directly to the add page, doesn't it auto login in the background and then bring them to the original link?
Thanks,

Tim

admin 6/7/2019

Not sure why this is happening but using a recommended API is the way to go:

https://xlinesoft.com/asprunnernet/docs/secapi_get_user_name.htm

T
Tim author 6/12/2019

Thank you. Old habits die hard I suppose. This did help with one of my issues, but the bigger problem was, when I landed on that add page from the link, it redirects to the login, and then back to the add page (as it should), which means that when it comes back after login, the POST value is no longer there. I solved this by using the "After application initialized" event and added the post value to a session, like so:

if (MVCFunctions.postvalue("t")) {

XSession.Session["TrainingSchedule"] = MVCFunctions.postvalue("t");

}


Thanks for your help.
On a side note, I didn't reply sooner because I didn't get an email when you posted your reply, even though I am "subscribed" to this topic. I am also subscribed to this forum, but I havn't gotten emails from the last few posts. It seems like emails stopped after you were hacked. Is there some residual problem with forum emails? Has anyone else noticed this?
Thanks,

Tim

admin 6/13/2019

Your approach makes sense. You need to save all parameters passed via URL before the first redirect.

Pete K 6/14/2019



On a side note, I didn't reply sooner because I didn't get an email when you posted your reply, even though I am "subscribed" to this topic. I am also subscribed to this forum, but I havn't gotten emails from the last few posts. It seems like emails stopped after you were hacked. Is there some residual problem with forum emails? Has anyone else noticed this?



Got my digest notification for the first time since before the hack this morning.

T
Tim author 6/14/2019



Got my digest notification for the first time since before the hack this morning.


Yes, I'm getting emails again now too.

admin 6/14/2019

We have changed SMTP passwords but forgot to make the same change here. Should be all working now.