I have xml as below:
<?xml version="1.0" encoding="utf-8" ?>
<menus>
<menu name="WeightManagement">
<user name="eu01\bsoni"></user>
<user name="eu01\bve"></user>
</menu>
<menu name="CategoryManagement">
<user name="eu01\bsoni"></user>
</menu>
</menus>
I have windows authentication and want o check if user "eu01\bve" has access to Weight Management or CategoryManagement menu.
How can I do with checking randomly from xml for menu and user?
You can also do
var doc=XDocument.Load(yourXmlFile);
string access=doc.Descendants().Elements("user")
.Where(x=>x.Attribute("name").Value=="eu01\bve")
---------
.First().Parent.Attribute("name").Value;