Excluding Action From Authorization In ASP
Jun 4, 2010
I am using forms authentication in my ASP.NET MVC application. I want to the signup page from the authorization process. I know I can add a location tag in my main web.config file or create a new web.config inside the specific folder. But I just to exclude one specific action in the User controller. How do I do it?
View 4 Replies
Similar Messages:
Mar 29, 2011
I am using ASP.NET MVC 3 and am trying to do something that should be really straight forward...
My application uses Forms authentication and that is working perfectly for controllers/actions. For example if I decorate either a controller or an action with the attribute below only members of the administrators group can view them:
[Authorize(Roles="Administrators")]
However I have a folder under the default Scripts folder called Admin. I only want members of the Administrators group to be able to access scripts within this directory so I created a new web.config in the directory with the following inside:
[code]....
However no matter whether a user is a member of the Administrators group or not they receive a 302 Found message and are then redirected to the login page.
If I change the web.config to allow user="*" then it works. It also works if I add an allow users="Username" for a specific user I am testing with.
View 1 Replies
Jun 28, 2010
When a user attempts to directly visit the url admin.aspx, and they are not an admin, they are redirected to the login page. However, the user then attempts to visit ViewWeek.aspx, it indicates that they are still logged in. Why does this ASP.NET authorization boot the user to the login screen, yet keep the user logged in? I'd rather it just direct the user to the default URL specified in the forms tag.
Here's my Forms Authentication:
<authentication mode="Forms">
<forms name=".ASPXFORMSAUTH" defaultUrl="ViewWeek.aspx" timeout="50000000" />
</authentication>
View 1 Replies
Apr 26, 2010
Our team has recently implemented a role permission based authorization so that we can have granular control. This is similar to what Rockford Lhotka suggests herehttp://www.lhotka.net/weblog/PermissionbasedAuthorizationVsRolebasedAuthorization.aspx I have also read about the Claims based authorization which to me looks very similar to what we have. Can some one put in simple terms what the advantages of claims based authorization are.
View 1 Replies
Dec 30, 2010
Looking through my web logs, I see a lot of entries that don't interest me. Some of them are commonly used images, css files, and scripts, which I can easily exclude by un-checking the 'log visits' check box in IIS for the folder properties.
I would also like to exclude log entries for certain common requests which are not in their own folders. Mostly, 'favicon.ico'. 'scriptresource.axd', and 'webresource.axd'. These (especially scriptresource.axd) make up almost a third of a typical log file on my site.
View 1 Replies
Aug 16, 2010
I have a requirement where i want compare only the date part of a DateTime Object not the seconds with the another object.I tried if(DateTime.Compare(dt1, dt2) == 0) where it compares both date and seconds, but i want only date part.
View 3 Replies
May 26, 2010
This may not be correct place to rise this question. Even i'm making here..
My requirement is to get the number of days from from date to end date (for Eg. I have to text boxes from date and to date i will send datetime value to my Stored porcedure i need to calculate no of days between these dates (i.e. no of wroking days) Is there any function to achieve this in SQL SERVER 2005)
View 4 Replies
Jan 15, 2010
i'm very new to this world, and trying to develope a system that calculates Holidays. I want to exclude saturdays and sunday but it doesnt.
[code]...
View 1 Replies
Jul 6, 2010
I need to create a SELECT statement for a table that excluded the TOP 10 records.
"SELECT TOP 10 field1,field2,field3 FROM AppData ORDER BY field1 DESC" returns the first 10 records from the table but I need to retrieve only from the 21st record onwards.
I simply don't know how to do it because I'm not that strong with SQL. I searched the forum for some answers but can't find a solution that I can understand.
View 4 Replies
Jan 4, 2010
Is there any way, I can exclude the whole row if one particular column has zero in it. I have this query
select first_name, last_name , employee_num, cubeNumber, extension
from tblData left join tblfacility
ON tblData.employee_num = tblfacilit.employee_num
left join tblextension ext
on tblData.extension = ext.extension
tablExtension has phone number extension in it. If we don't know someones phone extension, we put zero for their extension, now there are tons of people who have zero extension.when I run this query, it returns same name lot of times with different cubeNumber so I get
Fisrt_name last_name employeenum cubeNumbae extension
a ax 1 12 0
a ax 1 13 0
a ax 1 14 0
b bx 2 12 0
b bx 2 13 0
b bx 2 14 0
Both emploee a and employee b extensions are zero in above case. I want both a and b to be displayed only once .Right now it is displaying them so many times with all the cubesNumber that have extension zero.
View 8 Replies
Apr 25, 2010
I need to know if I've done something wrong, or if the message I'm getting is nothing about which to be alarmed.I'm getting "The relationship '....' has columns that are not part of the key of the table on the primary side of the relation ship which is not supported, the relationship was excluded.
I built four tables, each with one foreign key. I'm assuming I haven't done anything wrong or unusual with my four tables (SQL statements generating the tables are shown below).However, I don't get any lines connecting tables together and all the examples I've seen today seem to have no problem with drawing the connecting lines all over the place.
[Code]....
View 6 Replies
Feb 4, 2011
I want to display the number of days left until next friday, but not counting Saturday or Sunday.
For example, the following would display the number 7.
[Code]....
[Code]....
View 5 Replies
Jul 2, 2010
I tried excluding some files and folders in VS 2008 and they just disappear when I just want them to appear "whited" out. How can I change this behavior?
View 1 Replies
May 7, 2015
There is a Textbox in which only 50 charactes are allowed to enter "excluding spaces between the characters"How to validate it as per requirement.
View 1 Replies
Sep 3, 2010
So we use formviews all over the place that recently we've started putting user controls inside that have databinding controls inside them. In this instance it's a grid so
<formview>
<edititemtemplate>
<dynamiccontrol DataField="name" />
<customGrid DataField="addresses">
<columns>
<dynamiccontrol DataField="city" />
</columns>
</customGrid>
</edititemtemplate>
</formview>
That's the basic sitch. We have the customGrid, a usercontrol, bind to a collection on the main DataItem, and it contains dynamiccontrols (DD4) in its column templates so stuff in the cells displays right. (in reality, the customGrid is inside a dynamiccontrol like all the other fields here and is loaded based on ui hints, I've just stuck it in the pseudo-markup here for illustration). This works a charm, up until you try and update the formview. At that point, the FormView grabs all the keys from all the dynamiccontrols in its edititemtemplate, including keys and values from dynamiccontrols insde the customGrid control. Obviously this doesn't work as those are for an "address" object or something, and the formview is bound to a "person" object. What i desperately need is a way, inside customGrid, to stop FormView from getting out all the dynamiccontrol keys and values inside it. Overriding DataBindChildren doesn't work, nor DataBind. I don't know at what point or how the FormView queries its instantiated template for all the 2-way databinding controls it has inside it, but if I could get at that maybe I could figure something out. Or else, if I could make the customGrid stop sending back all the values inside it.
I tried overriding the formview's OnItemUpdating but that only so much; I can remove entries from the e.NewValues collection if they don't exist on the DataItem, but that doesn't if your custom sub control is binding items with fields of the same name as your main dataitem. There must be a way to abort this 2 way databinding in the custom control.
View 1 Replies
Nov 24, 2010
How to count no of site hits of a site with out using postbacks i.e we should not count
no of postbacks of a page only single hit should be taken in to account..
View 3 Replies
Nov 29, 2010
I'm implement Comet in Asp.net MVC, I used timer to keep Async request in server, Async request will complete when timer elapsed 1 minute and response to client (to avoid 404 error) and then reconnect to Async Controller. I also wanna execute some Synchronous action during Async request was holding, but the problem is: When an Async action was executed and hold by using timer, the Sync Action wasn't called until Async action (comet long-live request) completed. I did test with firefox 3.6 many times, but the result is the same, so strange, Do you know why ? I have a sub some questions : To implement comet, using timer (response after some minutes elapsed) or thread (response after several time sleeping thread) to hold async request, which is better?
View 1 Replies
Mar 23, 2011
I am desiging a master and details page from a search page..user can search for something and I need to display the result in jqgrid if the result has more than 1 row or record.. if the result is just one record then i have to directly send then to details page by skiping grid page... I do have an action method for results page and one more action method for Jqgrid data..i am trying to check the row count for the database result and trying to redirect to details action results..but its not working at all..and showing an empty jqgrid..
[Code]....
View 9 Replies
Apr 29, 2010
Lets say I have a simple controller for ASP.NET MVC I want to test. I want to test that a controller action (Foo, in this case) simply returns a link to another action (Bar, in this case).How would you test TestController.Foo? (either the first or second link)
My implementation has the same link twice. One passes the url throw ViewData[]. This seems more testable to me, as I can check the ViewData collection returned from Foo(). Even this way though, I don't know how to validate the url itself without making dependencies on routing.The controller:
public class TestController : Controller
{
public ActionResult Foo()[code].....
View 1 Replies
Sep 17, 2010
i have a website which has 3 modules admin part,employee part and customer part . so when the admin login he has to see the number of customers logged in and the duration etc excluding employee and admin
View 4 Replies
Jan 21, 2011
I have developing ASP.Net Website and has a Webform with lots of controls. I have so many different controls on my page like buttons, textboxes, etc.
Now what happens is that generally on any form, when user hits Enter Key, it fires the first default button's click event or if focus is on any button, it fires that button click. I want to avoid this.
When user hits enter key on form basically nothing should happen. But let's say if he is entering into multiline textbox, that enter key should work to go to next line in that textbox.
I tried this.
[Code]....
but the problem is that then it disabled enter key for everything. But what I am looking for is that to avoid any button click event or any other postback to happen when user hits enter key while being on form anywhere. But Enter key should work when it is inside textbox or inside any such control.
View 2 Replies
Jun 12, 2010
My httppost action doesnt seem to have received my model. The code is below;
[Code]....
i put a breakpoint on the line; return RedirectToAction("Error", "Dashboard"); and i found that appQualif carried no values whatsoever from the form i submitted..
View 5 Replies
Dec 27, 2010
i need to caluculate diffrence between two dates exculding saturdays & sundays
string startdate1 = 12/01/2010;
string enddate1 = 12/31/2010;
datetime diff = Convert.todatetime(startdate1 - endate1) how to exculde weekends
View 1 Replies
Jun 30, 2010
I've been using Html.Action("ActionName", "ControllerName") to invoke child actions across controllers without needing to have the view in ViewsShared. This has been working great for displaying things like session or cookie information.
Instead of just accessing cookies, I would like to pass additional parameters to Html.Action("ActionName", "ControllerName") so the action can execute different code based on the the data passed to the original view.
Should I be using a different method to pass parameters to a child action in a different controller?
View 1 Replies
May 20, 2010
I'm trying to add file upload functionality to a page. I've got a form that posts the selected file to a controller with a 'savefile' method. But if I don't add a get version of 'savefile' I'll get a 404 error. Here is the form code which is presented on the Index page:
[Code]....
And here is the controller code:
[Code]....
Intuitively I don't think I should need a GET version of SaveFile but if omit it I get a 404 error when the form posts. Why should I need a GET version of SaveFile when all I want is to post a form and save the file?
View 4 Replies