C# - Get Processes That Belongs To A Particular Session?
Dec 9, 2010
I want to get all the processes that is meant for a particular session.
i.e if there are two persons who are using my web application then i want to get all the processes used by user1 and all the processes used by user2.
I can get all processes by writing Process.GetProcesses() but how to get it in a group.
e.g:
User1: Process342
User1: Process151
User2: Process452
User2: Process674
User2: Process111
View 1 Replies
Similar Messages:
Mar 10, 2010
I'm running IIS 7 on Server 2008, with a single AppPool for an application which is basically just a collection of ASP.NET WebMethods. Some of these methods process for hours before they return. What's weird,is that sometimes when I launch multiple simultaneous requests IIS spins up a single w3wp process (and seems to share it amongst the requests) and other times it spins up multiple w3wp processes.
View 1 Replies
Oct 15, 2010
in my ASP.NET app happen asynchronously (i.e in background threads without any access to HttpContext). Let me take an example of one such action. The app would be deployed to a web farm soon.
The background threads would be processing files deposited to a network share location. So, when the app starts, I create a FilesystemWatcher to monitor activities on the desired network share folder.
As soon as a new file arrives, the code processes it and marks it as completed processing.
The problem is with multiple servers watching the same network share, the same file might get processed on different machines, meaning redundant results. On a single server, I use locking mechanisms to prevent race conditions.
Now how to prevent the same on a web farm?
View 3 Replies
Sep 20, 2010
I'd like to display an animated gif after user presses a submit button which causes postback. I'm following Joe Stagner's tutorial
here. The page worked fine. But now that I've added the update panel around the button and then an update progress with a gif in it, the app doesn't run.
Now, when the button is pressed, the animated gif appears and runs for about three seconds or so (due to the artificial latency added as per the tutorial - System.Threading.Thread.Sleep(3000) ) and then it stops, nothing returns from the server.
What am I doing wrong and what am I not understanding with this Ajax process and the server?
(by the way I'm using the toolscript manager that came with the Ajax control toolkit, don't know if that matters)
[Code]....
View 4 Replies
Jan 15, 2010
I'm firing the my ModalPopupExtender from a server side button click (bthAuth) and then need to hide that button after my processing is complete. When btnAuth.Visible = False is called it displays the ModalPopupExtender. If I remove this piece of code the window goes away like it should.
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnAuth" BackgroundCssClass="modalBackground" PopupControlID="ModalPanel"> </cc1:ModalPopupExtender>
btnAuth_Click():
bunch of stuff here()
btnAuth.Visible = False -- This is what is causing the ModalPopupExtender to stay displayed.
On Page Load:
btnAuth.OnClientClick = String.Format("fnClickUpdate('{0}','{1}')", btnAuth.UniqueID, "")
Function:
<script type="text/javascript">
function fnClickUpdate(sender, e)
{
__doPostBack(sender,e);
}
</script>
View 4 Replies
Feb 4, 2010
I'm currently experiencing and issue on whether to say a connection has been left open due to my code or if it's left open due to ADO.NET pooling. Here's a sample of my code:
Public Function ExecuteDataTable(ByVal strStoredProc As String, Optional ByVal objParams As SqlParameter() = Nothing, Optional ByVal cmdType As CommandType = CommandType.StoredProcedure) As DataTable
Dim objDt As New DataTable
Dim objAdapt As New SqlDataAdapter
Dim objParam As SqlParameter
Try
OpenDb()
If Not IsNothing(objParams) Then
AddParams(objParams)
End If
objAdapt.SelectCommand = New SqlCommand
With objAdapt.SelectCommand
[Code].....
Then when I go to open up the SQL Mgmt Studio, I look into the processes and the particular connection that has ran with the SQL that my function runs appears to remain open. So to me, it looks like ADO.NET is performing some kind of pooling. Is it safe to make that conclusion? How would I be able to tell if the connection is available to be used again by the ADO.NET pool?
View 2 Replies
Sep 21, 2010
When IIS restarts an ASP.Net (2.0) web application, it can either:
Recycle the AppDomain: Unload the AppDomain and load a new AppDomain on the same process (e.g. when HttpRuntime.UnloadAppDomain() is called, when web.config is changed).
Recycle the process: unload the AppDomain and load a new one on a new process (e.g. when invoking Recycle command on an AppPool via inetmgr, or when memory limit is reached).
Due to some internal reasons (trouble with legacy native code we depend upon), we cannot allow the first option. We just can't load the application twice on the same process.
Can IIS be somehow told to never allow worker process reuse?
I've tried preventing it myself by tracking whether an application has already started on a process once using a Mutex, and if so - throwing an exception during Application_Start()); I've also tried terminating the process by calling Environment.Exit() during Application_End(). The problem with both methods is that it causes any requests that arrive during Application_End or Application_Start to fail (unlike a manual process recycle, which fails absolutely no requests because they are redirected to the new process right away).
View 2 Replies
Sep 4, 2010
I am new to .NET dev and I cut and paste a lot of code. One strugel i have is when I I use a class name, I need to find out what I need to add in the reference (using clause at the top) and what DLL to use. Is their a easy way to find out what class is on what DLL. My pc is littered with 500 - 600 .NET dll.
View 4 Replies
Dec 12, 2010
I have a problem regarding data row.
What i am trying to do is that i have records that are in ascending order. Now, i have to get a few lowest data rows(based on the average) from the table and add them to a separate table and delete the rows from the previous table.
This is my code where i am getting the top few rows and adding them to the array list (I have also tried DataRow[], DataRowCollection, string[] but i get the same error).
ArrayList delRows = new ArrayList(diff);
View 1 Replies
Mar 19, 2011
How can I show loading image for the user while executing long running process in an ASP.Net Ajax application? Is there a way other than using Page Methods? Any ideas?
View 2 Replies
Sep 8, 2010
I have a windows user accounts which i just created take XYZ for example.
This XYZ belongs to a User group and a custom group i created in Computer Management --> Local users and groups.
So in properties i see that the user belongs to the 2 groups.
Now i want to get those groups and display them. any suggestions???
i have done this but this is not right as it gives me the roles of SQL (i think)
here is what i did:
after logging in and impersonating i call the function
getUserGroups();
private void getUserGroups()
{
// collect the user domain and identity
string[] arr =
System.Web.HttpContext.Current.Request.
LogonUserIdentity.Name.Split('\');
// update the display to show
// the captured domain and user
if (arr.Length > 0)
{
new GUIUtility().LogMessageToFile("User Name" + arr[0].ToString());
new GUIUtility().LogMessageToFile("User Domain" + arr[1].ToString());
}
// create an arraylist and populate
// it with the list of groups that
// the current user belongs to
ArrayList al = new ArrayList();
al = GetGroups();
// check to see if the user belongs
// to a specific group and create
// a list of all of the user's groups
foreach (string s in al)
{
// add this one to the list
new GUIUtility().LogMessageToFile("Group" + s);
// check to see if the user
// belongs to a specific group
//if (s == "BXSWLT\SomeCustomGroup")
//{
// // change the label to show
// // there was a match
// lblMemberOfGroup.Text = "YES";
//}
}
}
public ArrayList GetGroups()
{
ArrayList groups = new ArrayList();
foreach (System.Security.Principal.IdentityReference group in
System.Web.HttpContext.Current.Request.LogonUserIdentity.Groups)
{
groups.Add(group.Translate(typeof
(System.Security.Principal.NTAccount)).ToString());
}
return groups;
}
the Result i get is:
9/8/2010 5:57:22 PM: User Name NT AUTHORITY.
9/8/2010 5:57:22 PM: User Domain IUSR.
9/8/2010 5:57:22 PM: Group Everyone.
9/8/2010 5:57:22 PM: Group BUILTINUsers.
9/8/2010 5:57:22 PM: Group NT AUTHORITYAuthenticated Users.
9/8/2010 5:57:22 PM: Group NT AUTHORITYThis Organization.
9/8/2010 5:57:22 PM: Group LOCAL.
View 1 Replies
Jun 29, 2010
simple explanation like:- four blocks all connected to one server hosting a website using iis 5 c# i want if user from block a accesses the home page the page says block A user how are you, same goes for all blocks so how to identify from where the request is coming from in this simple scenerio
View 1 Replies
Apr 21, 2010
I have an ASP.NET 3.5 application using Windows Authentication and implementing our own RoleProvider.
Problem is we want to restrict access to a set of pages to a few thousand users and rathern than inputing all of those one by one we found out they belong to an AD group.
The answer is simple if the common group we are checking membership against the particular user is a direct member of it but the problem I'm having is that if the group is a member of another group and then subsequently member of another group then my code always returns false.
For example: Say we want to check whether User is a member of group E, but User is not a direct member of *E", she is a member of "A" which a member of "B" which indeed is a member of E, therefore User is a member of *E"
One of the solutions we have is very slow, although it gives the correct answer
using (var context = new PrincipalContext(ContextType.Domain))
{
using (var group = GroupPrincipal.FindByIdentity(context, IdentityType.Name, "DL-COOL-USERS"))
{
var users = group.GetMembers(true); // recursively enumerate
return users.Any(a => a.Name == "userName");
}
}
The original solution and what I was trying to get to work, using .NET 3.5 System.DirectoryServices.AccountManagement and it does work when users are direct members of the group in question is as follows:
public bool IsUserInGroup(string userName, string groupName)
{
var cxt = new PrincipalContext(ContextType.Domain, "DOMAIN");
var user = UserPrincipal.FindByIdentity(cxt, IdentityType.SamAccountName, userName);
if (user == null)
{
return false;
}
var group = GroupPrincipal.FindByIdentity(cxt, groupName);
if (group == null)
{
return false;
}
return user.IsMemberOf(group);
}
The bottom line is, we need to check for membership even though the groups are nested in many levels down.
View 3 Replies
Aug 24, 2010
In C#, how do i access Active Directory to get the list of groups that a certain user belongs to?
The user details are in the form:
"MYDOMAINmyuser"
I've been following the instructions from here but they only work if i have the user details in the form:
"LDAP://sample.com/CN=MySurname MyFirstname,OU=General,OU=Accounts,DC=sample,DC=com"
So maybe what i'm asking is, how to get from the first, shorter, form to the fully qualified form below?
View 2 Replies
Oct 28, 2010
I have the following AD Strucure
Domain Controller with the Name like abc.com ........> Groups Folder .....>>>UserGroups >>> Subgroup >>>> List of Users
I did the following but not succeed
[Code]....
Iam getting the Count == 0 at the below line
int groupCount = result.Properties["memberOf"].Count;
View 2 Replies
Mar 26, 2016
I am using the C# code you posted in the link below,
[URL]
but when I run it I am getting the error:
"A column named 'link' already belongs to this DataTable: cannot set a nested table name to the same name."
View 1 Replies
Dec 29, 2010
I have a treeview and all nodes are check box, when user clicks on a button, how can I get all the checked child nodes belongs to specific parent? I wanna something better...
private TreeNodeCollection GetCheckedNodeForParent (string parentNode)
{
TreeNodeCollection treeNodeCollection=new TreeNodeCollection();
foreach (TreeNode node in tvBaseline.FindNode(parentNode).ChildNodes)
{
if (node.Checked)
treeNodeCollection.Add(node);
}
return treeNodeCollection;
}
View 2 Replies
Oct 20, 2010
I have enabled User Rolls and assigned several Roll names such as 10, 11, 12, etc. I have a SQL Table that contains various fields of information including one named AuthorizedUserRoll, it's nchar(2).
A logged in user should only see the records in Gridview that matches his/her roll.
I'm using Web Forms and VB.
View 1 Replies
Oct 13, 2010
I have the selected DataKey in session from the ListView. I am able to set the selection back when I comeback to this aspx page containing listview. But when the selected item in the listview belongs to some other page (not the first listview page) then I need to also set the selected listview page to the one, where my item belongs. I use a listview and a datapager (with template paging) How can I find, in which page my item to be selected exists?
View 1 Replies
Sep 14, 2010
I added the following code to global.asax to load up several session variable when a session starts. I'm assuming that when a page goes to use the variable that I should be
1) checking at the page level that the value is valid not 0 when its not expected to be 0, not a zero-length string when its expected to have a length
2) have code at the page level that sets the values if the values have not been set as when the Session timeout, ideally putting the code in a class derived from Page and then deriving all of my pages from the new class so that the code does not have to be repeated in every page
[Code]....
View 7 Replies
Mar 2, 2011
I have a problem by getting session which created for new site visit or session expired.
View 3 Replies
Feb 25, 2016
I want the code for showing popup dialog box , to show the time remaining for session closing because of in-activity. and 2 buttons for allowing to stay or to signout.
i want all the settings that are need to achieve the functionality.
View 1 Replies
Jul 27, 2010
I have a class called EditMapUtilities. Here are some class properties that I want to persist:
public class EditMapUtlities
{
public static Boolean isInitialEditMapPageLoad
{
get { return SessionHandler.isInitialEditMapPageLoad; }
set { SessionHandler.isInitialEditMapPageLoad = value; }
}
// REST OF CLASS NOT GERMAIN TO DISCUSSION AND OMITTED
}
Here is my SessionHandler Class following the pattern from this post Static Session Class and Multiple Users:
using System.Web.SessionState;
public static class SessionHandler
{
private static HttpSessionState currentSession
{
get
{
if (HttpContext.Current.Session == null)
throw new Exception("Session is not available in the current context.");
else
return HttpContext.Current.Session;
}
}
//A boolean type session variable
private static string _isInitialEditMapPageLoad = "EditMapInitialPageLoad";
public static bool isInitialEditMapPageLoad
{
get
{
if (currentSession[_isInitialEditMapPageLoad] == null)
return true;
else
return (Boolean)currentSession[_isInitialEditMapPageLoad];
}
set
{
currentSession[_isInitialEditMapPageLoad] = value;
}
}
}
I am still learning OOAD. I want to keep relevant properties with relevant classes. I also want to keep all Session stored variables in one place for ease of maintenance and to encapsulate the session keys and calls. I feel like my design is too coupled though. How can I make it more loosely coupled? Is my editMapUtilities class too tightly coupled to the SessionHandler class? How would you do it better?
View 2 Replies
Feb 1, 2011
Let suppose, I am building an asp.net website which has login scenario in it. I want to provide a certain functionality to the website that if the user is already login on computer 1 and now try to login on computer 2, so he will be allowed to remain login on computer 2, while automatically logout him from computer 1. I also know that http is a stateless medium, so whenever user interact with computer 1 and try to interact with the page, it will get noticed at that time.
View 2 Replies
Feb 4, 2011
Is there room for issue in the following code in terms of multiple users of the same web application? I mean, I know that a purely static string will be shared across all sessions for a single ASP.NET application, but since this explicitly refers to the Current.Session, even though it is static it seems like it would always refer to the session instance of the "current user." But an error is happening that could be explained by everyone sharing the current value of Mode and thus the most recent change overwriting everyone else's mode value. (As a background: This string is in a Helpers class that is used throughout the application. I do not want to make references to Session["Mode"] throughout the application and do not want to have to pass Session["Mode"] in every method call from an aspx.cs page.)
public static string Mode
{
get
{
var value = HttpContext.Current.Session["Mode"];
return (value ?? string.Empty).ToString();
}
set
{
HttpContext.Current.Session["Mode"] = value;
}
}
View 2 Replies