Validation On Blood Groups In Asp.net?
Feb 15, 2010in my application i going to validate the blood groups, can u tell me how can i validate blood groups.
View 1 Repliesin my application i going to validate the blood groups, can u tell me how can i validate blood groups.
View 1 Repliesbasically i have a page with the followingtextbox1 button1 and required field1 /validator callout1textbox2 button2 and required field2 /validator callout2button1 needs to only call validation controls1 and button2 needs to call validation controls2. how do i do this. I'm not really sure what to search for so any links to a tutorial/explanation
View 3 RepliesI have a Form like this.
UserID has to be validated when user clicks "Check Availability" and "Submit"
Hence "UserID" required field validator has to be assigned two grops.
As if now it is assigned only Group1
[code]....
I have already gone through How to validate against Multiple validation groups?
which talks about validating Group1 and Group2 when user clicks "Submit" which is a good alternate solution.
I have two validation groups: parent and child
I have an add button that needs to only validate the child validation group which is easily done. The save button needs to validate against the parent and child validation groups, both client side and server side. I think I know how to do it server side by calling the Page.Validate("groupname") method for each group, but how can it be done client side?
I have a multi section form which the user can jump between sections to complete. Each section has its own validation group associated with it. I want to create a summary page which itterates through each of the validation groups and outputs if it is valid or not by changing an associated text.The problem that I am having is that once one validation group fails validation all subsequent sections also report as failing - presumably as the page.isvalid is still holding the fact that a previous group has failed
View 1 RepliesI thought I could assign more than 2 validation groups, separated by comma as follows.
<asp:Button ID="Button2" runat="server" Text="both v1 & v2 validate" ValidationGroup="v1, v2" onclick="Button2_Click"/>
but it didn't work.What i want to do is, when a user clicks button1, it only validates validation group"v1" When button2 is clicked, it validates both "v1" & "v2" validatino groups.
<asp:TextBox ID="TextBox1" runat="server" ValidationGroup="v1"/>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" ValidationGroup="v1" ControlToValidate="TextBox1"/> [code]....
this file is uploaded to http://zuke.us/espada/test1.aspx
Is it possible for an ASP.NET Validation Rule to belong to multiple groups? I'd like to validate the same control in different ways based on what mode the form is in using a single Validator. For the purposes of this question, the modes are Simple, which requires fewer fields, or Complex, which requires more fields. I know I can write CustomValidators (which I have done in the past), but I'd like a simpler solution.
So, I'd like to combine the following:
<asp:RequiredFieldValidator ValidationGroup="Simple" ControlToValidate="Name" />
<asp:RequiredFieldValidator ValidationGroup="Complex" ControlToValidate="Name" />
What I would like to do is to validate my aspx before showing the confirmation diaglog. After long hours of searching on the Net I came up with this:Some Validation controls with 2 different validation groups (ValidationGroup1 and NoValidation)ValidationSummary control is set to ValidationGroup1 with MessageBox=TrueButton1 is set to ValiationGroup1 (this button is hidden)Button2 is set to ValidationGroup1 with javascript onclick function to click button1.
ConfirmButtonExtender1 with TargetControlID=button1
I have two validation groups 'Sub' and 'Normal'and i have some checkboxes . .
I need to validate depending on value of checkbox how to do this . .
I need to be able to validate multiple validation groups with the click of one button. My Form consists of two text boxes and a drop down list for input. The form also, currently, has three buttons, one for each control. Each of those buttons are tied to a validation control and if the validation is successful, it will add the user inputted data into a database that I have. The interesting part comes when I need to add a forth button which will act as a "Save All" Button. When this button is clicked, I need it to fire the three validation groups.
Is it possible to add multiple validation groups to the "Save All" Button?
In a multigrid i have validating two controls like date and amount.it is validating correctly when i press the tabevent.when i press the save button it is not validating.iam using two validations gruops and two validation summary.Then in save button i have also tried onclientclick() function with javascript it s working fine but if i give the correct value in date and amount records not saving how to over come this.
Date: ' runat="server" CausesValidation="true"
ValidationGroup="group" Width="80px" AutoPostBack="true" OnTextChanged="txtDate_TextChanged">
Amount" ' CausesValidation="true"
ValidationGroup="req" runat="server" AutoPostBack="true">
validations summary: button save: OnClick="ButtonSave_Click" TabIndex="6" />
how to validate this in the button save also two popup box should be shown
I have a Dynamic GridView on a page as below. The user can add or delete rows. When inserting record, the code is executed one row at a time. I have 3 rows to be inserted to the database. Here is the issue:
-if the first row is not completed, then no record is added to the database
-if the first row is completed and the second row is not, then only the first row is inserted in the database
-if the first row is completed, the second row is not complete, and the third row is completed, then only the first row is inserted in the database.
below is the code:
protected void GridView1_AddNewRecord(object sender, EventArgs e)
{
string constr = ConfigurationManager.ConnectionStrings["DatabaseVestConnectionString1"].ConnectionString;
SqlConnection con = new SqlConnection(constr);
SqlCommand cmd;
string query1 = "INSERT INTO kart_Bestilling(SakBehandlingCode, KystverketRegionID, KystverketAvdelingID, BestillerReferanse, BestillerLeveringAdresse, BestillerPostKodeBy, BestillerNavn, BestillerStilling, BestillerEpost, BestillerTelefon, BestillingBeskrivelse, BestillingDato, BehandlingSakNummer, BehandlingBeskrivelse, BehandlingStatus)" +
[code]...
How to arrange this piece of code to validate all rows before any insert? or avoid inserting a row if there is one row not complete?the conditions starts with int rowIndex = 0;
if (txtBestillerReferanse.Text != "" && txtBestillerEpost.Text != "" && txtBestillerNavn.Text != "" && txtBestillerPostKodeBy.Text != "" && ddKartTypeName.SelectedValue != "Velg KartType" && ddKartNummerName.SelectedValue != "Velg KartNummer" && tBestillingAntallKart1.Text != "")
I am "DomainMyDomainUserName" If I do this:
[Code]....
I can access the website I've created on my local machine in debug mode; and with my domain account as a local administrator, if I do this:
[Code]....
I can still access the website; and with my domain account in a Domain Group named "DomainDomainLocalSecurityGroup", if I do this:
[Code]....
I can still access the website; HOWEVER, if I create a Local Group on my machine named "LocalMachineGroup" and I add "DomainMyDomainUserName" to this group and I do this:
[Code]....
I get an Access Denied error trying to access the website. What I want to do is, have a group on my local machine (for testing), on a test web server, and on a production web server named "MyWebsiteUserAccess" with the same Domain Group (filled with Domain Users allowed access to the site) in all of these local groups; so that when I test the web application on my local machine, on my test web server and on my production web server, I don't have to change the Web.config file to have it work on each AND if the Domain Group name ever has to change, it won't affect access to the website.
What am I overlooking or is this even possible to do this way? I understand that there is a way to do Role Management through ASP.NET but I don't understand that well enough yet to implement that (and will probably go that route once I've done the research on how to best implement it for purpose of access control of this intranet site).
I have a user that when I attempt to enumerate her groups using either System.Security.Principal.WindowsIdentity.GetCurrent().Groups on user's computer
or System.Web.HttpContext.Current.Request.LogonUserIdentity.Groups on the IIS server, I get a list of their old groups, not their new. I have checked the DC that they authenticate to and the ASP.NET page is running inside a SharePoint instance so the LogonUserIdentity most like is being provided from there Kerberos ticket.
Should I be looking up the groups directly from the AD instead of relying on the WindowsIdentity or LogonUserIdentity?
i have a code to get the groups a user belongs to.
try
{
DirectoryEntry adRoot = new DirectoryEntry(string.Format("WinNT://{0}", Environment.UserDomainName));
DirectoryEntry user = adRoot.Children.Find(completeUserName, "User");
object obGroups = user.Invoke("Groups");
foreach (object ob in (IEnumerable)obGroups)
{
// Create object for each group.
DirectoryEntry obGpEntry = new DirectoryEntry(ob);
listOfMyWindowsGroups.Add(obGpEntry.Name);
}
return true;
}
catch (Exception ex)
{
new GUIUtility().LogMessageToFile("Error in getting User MachineGroups = " + ex);
return false;
}
the above code works fine when i have to find the groups of a local user but
for a domain user it returns a value "Domain User" which is kind of wierd as it is a part of 2 local groups.
Research
I did some finding and got that i am being returned the primary group of the domain user
called "Domain User" group
but what i actually want is the groups of the local machines the domain user is a part of... i cannot get that.. any suggestions
another code using LDAP
string domain = Environment.UserDomainName;
DirectoryEntry DE = new DirectoryEntry("LDAP://" + domain, null, null, AuthenticationTypes.Secure);
DirectorySearcher search = new DirectorySearcher();
search.SearchRoot = DE;
search.Filter = "(SAMAccountName=" + completeUserName + ")"; //Searches active directory for the login name
search.PropertiesToLoad.Add("displayName"); // Once found, get a list of Groups
try
{
SearchResult result = search.FindOne(); // Grab the records and assign them to result
if (result != null)
{
DirectoryEntry theUser = result.GetDirectoryEntry();
theUser.RefreshCache(new string[] { "tokenGroups" });
foreach (byte[] resultBytes in theUser.Properties["tokenGroups"])
{
System.Security.Principal.SecurityIdentifier mySID = new System.Security.Principal.SecurityIdentifier(resultBytes, 0);
DirectorySearcher sidSearcher = new DirectorySearcher();
sidSearcher.SearchRoot = DE;
sidSearcher.Filter = "(objectSid=" + mySID.Value + ")";
sidSearcher.PropertiesToLoad.Add("distinguishedName");
SearchResult sidResult = sidSearcher.FindOne();
if (sidResult != null)
{
listOfMyWindowsGroups.Add((string)sidResult.Properties["distinguishedName"][0]);
}
}
}
else
{
new GUIUtility().LogMessageToFile("no user found");
}
return true;
}
catch (Exception ex)
{
new GUIUtility().LogMessageToFile("Error obtaining group names: " + ex.Message + " Please contact your administrator."); // If an error occurs report it to the user.
return false;
}
this works too but i get the same result "Domain Users" . Please can some1 tell me how to get the local machine groups...?
I am using one datalist control for uploading multiple images.I hv used one Asp:FileUplaod Control and one button in one itemtemplate.I am using reqired field validator and regular expression validator for file upload cntrl I am assigning validation group for both of them on ItemDataBound event of my datalist so that each upload cntrl hv same validaton group as required field and regular expression validator.Now what i want to do is - i want to show my error message in validation summary which is right at the top of the page.I want one know how to write javascript that will assign validation group of my control in datalist on which i click ?
View 1 RepliesI wrote this to get the groups a particular user belongs to:
DirectoryEntry AD = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer");
DirectoryEntry user = AD.Children.Find(completeUserName, "user");
object obGroups = AD.Invoke("Groups");
foreach (object ob in (IEnumerable)obGroups)
{
// Create object for each group.
DirectoryEntry obGpEntry = new DirectoryEntry(ob);
listOfMyWindowsGroups.Add(obGpEntry.Name);
}
for (int j = 0; j < listOfMyWindowsGroups.Count; j++)
{
//ex
}
How is it possible to retrieve all the groups in windows and not just for a particular user?
I'm trying to determine if there is a Yahoo API that I can use to create authentication based on membership in a Yahoo Group for a non-Yahoo website writte in ASP.NET. Basically, if a person is a member of a particular group, then they would be able to Login to this website.
Our club has an existing Yahoo site, but we'd like to disconnect from Yahoo while retaining the emailing capability that it offers, and I'd like to keep the number of places to be members of to a minimum. So if a person signs up for the Yahoo group, I'd like them automatically be able to login to the non-Yahoo site without any other steps.
I use this code to get the groups of the current user. But I want to manually give the user and then get his groups. How can I do this?
[code]....
I have a ASP.NET Website project and I need to list all the users and their groups on my Windows system. I have set the identity impersonation to true and provided the username and password of the admin in the web.config. Where do I start?
Update:
I have the following code at the moment -
var machine = new DirectoryEntry("WinNT://<IP ADDRESS>");
foreach (DirectoryEntry child in machine.Children)
{
// get the child's group(s).
}
When I debug, I can see the list of users in machine.Children. How do I find the group(s) that this user belongs to?
In asp.net/c#, is there a way to find all of the AD level user groups from a given domain in which the logged in user belongs to? E.g. I have a domain level user and few groups. I want to pass in the domain name and the logged in user's user name and get a list of AD groups of that particular domain.
View 2 RepliesI have a query that returns a pretty big result. I want to break the big set into several smaller sets to pass into a function. If i had a 100 records returned, how would i get 10 datasets?
View 1 RepliesI 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.
i have the code to get the members of a local group example administrators
private void GetUserGrps()
{
using (DirectoryEntry groupEntry = new DirectoryEntry("WinNT://./Administrators,group"))
{
foreach (object member in (IEnumerable)groupEntry.Invoke("Members"))
{
using (DirectoryEntry memberEntry = new DirectoryEntry(member))
{
new GUIUtility().LogMessageToFile(memberEntry.Path);
}
}
}
Is there a way to get the groups a local user belongs to using directory services?
without using activedirectory or domain in it because i want for the local machine only and not for a domain.
How can I declare multiple groups in LINQ? I get this error "Range variable 'Group' is already declared." Error found in bold and underlined text below.
Dim SportsWear = From c in dbContext.SportsTable Group Join grp_Attire In dbContext.AttireTable On grp_Attire.AttireId Equals c.AttireId Into Group From sportsAttire In Group.DefaultIfEmpty() Group Join grp_SportType In dbContext.SportType On grp_SportType.TypeId Equals c.TypeId Into Group From sportsType In Group.DefaultIfEmpty() Select New With { _ .Attire = sportsAttire.AttireName,.Type = sportsType.TypeName}