|
I need this for a site i m to upgrade,
there is the admin folder and
an 'admin' user, now i need hierarchy
for the admin so i need to limit/allow
access to pages by the user the has
logged in
|
|
|
|
|
Check out MSDN for IsInRole:
Something like this:
modifiy the web.config as:
<authorization>
<allow roles="MyDomain\MYCOMPANY_ADMINISTRATORS">
And the Page_Load Code is:
protected void Page_Load(object sender, EventArgs e)
{
if (Context.User.IsInRole("MyDomain\\WMS_ADMINISTRATORS"))
{
Label1.Text = Context.User.Identity.Name + " is part of ROLE";
}
else
{
Label1.Text = Context.User.Identity.Name + " is NOT part of ROLE";
}
}
|
|
|
|
|
Tnx,
but what i meant was doing it without any code in the page,
if i use code i can use the session and simply check it on each page,
I have a login page that verifies credentials against the web.config
I was wondering weather i can define, in the web.config, access to several pages
to specific users or roles while different pages allow other users/roles access.
Thus using only the web.config for that.
|
|
|
|
|
You have 2 options:
1) create a separate Web.config file in the directory to be secure.
2) add some more elements to the Web.config
example:
<location path="administrators">
<system.web>
<authorization>
<allow roles="Administrator">
<deny users="*">
|
|
|
|
|
But can i have different access to two pages in the
same directory?
|
|
|
|
|
Have you tried changing the location?
<location path="myPage.aspx">
|
|
|
|
|
hi all,
i am having dropdown list and checkboxlist in my webform.
i need to populate data in checkboxlist based on item selected in drop down list.
i want all these done using client side script( java script) with out posting to server.
please help me as soon as possible.
Thanks in advance
regards,
sumanth
this is sumanth, from india.
|
|
|
|
|
add attributes onChange in drop down list and call any jascript function,
in java script function get chckboxlist using document.getelementbyid
and populate the data as per u'r requirement.
Parwej Ahamad
|
|
|
|
|
Hi Parwej Ahamad,
Thanks for quick replay.I already used the same thing as you explain, but the problem is
getElementById('chklst').options is not working.
Can you give some code example regarding this.
Thanks in advance.
regards
sumanth
this is sumanth, completed m.c.a from india.
|
|
|
|
|
var no = new Option();
no.value = fbox.value;
no.text = fbox.value;
lstbox.options[tbox.options.length] = no; //lstbox get object by get elementbyid
Parwej Ahamad
|
|
|
|
|
Hello,Sir
I Created a one html page in asp.net web app,in that window.location working fine,but when i copied that page into the directory of asp project it does not redirect,and also in status bar iam getting error at window.location
Why its happening
Advanced Thanks
Srilakshmi
|
|
|
|
|
hi Sri,
can u send the problem clearly. orelse just place the cursor on the line where u r getting the error and press F1.if MSDN is alredy installed in ur system, it will show u the reason why u r facing this problem.
regards,
Rahithi
Forget about the mistakes that u can't change New,but don't forget the lesson that you've learn't
|
|
|
|
|
If you are new in asp.net, then you may have forgotten to define a (runat="server") attribute for any client-server interaction whereever it may count in your program.
|
|
|
|
|
Hi..
I have a DropDown which is populated from a Project table. This table has a foreign key a Stage table which also populates another DropDown. Both Databindings occur in the Pageload event.
Each Project can have many stages, but each stage belongs to one project.
I have set the AutoPostBack Property of the DropDown for the Project Table to true. Here's what I need to implement:
1. Load page. Default Project is auto selected on the Project DropDown. Therefore relevant Stages are listed in the Stage DropDown.
2. Select another Project from the list. The Stage DropDown will automatically change to show a list of the stages available for the selected Project.
Please help. Any suggestions will do.
PS. I know I have to place some code in the ddlSearch_SelectedIndexChanged method. I just don't know what though.
|
|
|
|
|
What you need to do is populate the first drop down list(project) in the load event of the page. And on selectedindexchanged event populate the second drop down list(stage) with the values corresponding to the project selected.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Thanks Apurva!
I will try that and try to make it work..
I may well return with another query =D
The Magnitude of flaws in Democracy at least equals that of Dictatorship, Communism and Monarchy.
-- modified at 7:08 Wednesday 1st November, 2006
|
|
|
|
|
no problem... always welcome..
Best Regards,
Apurva Kaushal
|
|
|
|
|
It works fine now =D
Although I also wanted the Stage DropDown to populate at Pageload. So I just made a copy.
Thanks again.
The Magnitude of flaws in Democracy at least equals that of Dictatorship, Communism and Monarchy.
|
|
|
|
|
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi
i have a form in which i have three panels. panels are set to 'true' or 'false' according to requirement. I am having a problem that whenever i go from my last panel to first panel, i get the following error
'ctl00_cphProps_Summary' is not null or not an object'
Summary is the ID for ValidationSummary control.
i am using atlas in that page too, but not in the panel which is creating that problem. when i use updatepanal of atlas for that panel, it starts working fine, but as i am using a fileupload control in that panel too and it doesnt work with updatepanel of atlas. so i have to do something with or without updatepanel in such a way that i can not have any kind of problem in anything.
can anybody suggest me the way to come out of that problem.
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
I m using dataview as datasource control for gridview. i m able to sort data once in descending order when click on column name but if i again click on column name it does not sort in ascending order
my code is:
public void GVPart_Sorting(Object sender, GridViewSortEventArgs e)
{
obj = new CLS();
//ViewState["sortexpression"] = e.SortExpression;
string direction = e.SortDirection.ToString();
if (direction == null)
{
direction = "asc";
}
else
{
if (direction == "Ascending")
{
direction = "desc";
//e.SortDirection = SortDirection.Descending;
}
else
{
direction = "asc";
}
}
obj.fillPartList(GVPart, e.SortExpression.ToString(),direction);
}
public void fillPartList(GridView GVPart,string sortparam,string sortDir)
{
BData bd = new BData();
sql = "SELECT P.PartId, P.PartNumber as PartNumber, P.PartDescription as PartDescription, L.LOBDescription as LOBDescription, C.PartCategory as PartCategory";
sql = sql + " FROM PartsDetails P";
sql = sql + " LEFT JOIN LOBDetails L ON L.LOBId = P.LOBId";
sql = sql + " LEFT JOIN PartCategoryDetails C ON C.PartCategoryId = P.PartCategoryId";
sql = sql + " WHERE P.IsDisabled = 0";
//sql = "SELECT PartId ,PartNumber,partDescription FROM PartsDetails WHERE IsDisabled = 0 and LOBId=18";
DataTable dt = bd.Select(sql, "PartInfo");
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
DataView dv = dt.DefaultView;
// DataView dv = new DataView();
//dv.Table = dt;
if (sortparam != null)
{
dv.Sort = sortparam
+" " + sortDir;
}
GVPart.DataSource = dv;
GVPart.DataBind();
}
neetu
|
|
|
|
|
How reset webform after saving data.
-- modified at 6:31 Wednesday 1st November, 2006
Reload page is one of the meethod but i don't want to reload page for reset task.
I want to do it by javascript.i use document.form1[].reset() or used many option like
function resetForm(){
//window.document.Form1.reset();
//document.form1["Invoice"].reset();
document.form1[0].reset();
//document.clear();
}
i call this function on clientclick event of servercontrol button.
it executes but not reset the page
neetu
neetu
|
|
|
|
|
You can reload the page on click of the server control. What is the problem you are getting in that?
Best Regards,
Apurva Kaushal
|
|
|
|
|
Yes it is one of the meethod but i don't want to reload page for reset task.
I want to do it by javascript.i use document.form1[].reset() or used many option like
function resetForm(){
//window.document.Form1.reset();
//document.form1["Invoice"].reset();
document.form1[0].reset();
//document.clear();
}
i call this function on clientclick event of servercontrol button.
it executes but not reset the page
neetu
|
|
|
|
|
The better idea would be to reload the page with serverside code. But if you want to use reset method then you can use it like this:
document.form1.reset()
Here form1 is the form name.
Best Regards,
Apurva Kaushal
|
|
|
|