Search Results

Search found 52899 results on 2116 pages for 'ado net'.

Page 34/2116 | < Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >

  • Site Security/Access management for asp.net mvc application

    - by minal
    I am trying to find a good pattern to use for user access validation. Basically on a webforms application I had a framework which used user roles to define access, ie, users were assigned into roles, and "pages" were granted access to a page. I had a table in the database with all the pages listed in it. Pages could have child pages that got their access inherited from the parent. When defining access, I assigned the roles access to the pages. Users in the role then had access to the pages. It is fairly simple to manage as well. The way I implemented this was on a base class that every page inherited. On pageload/init I would check the page url and validate access and act appropriately. However I am now working on a MVC application and need to implement something similar, however I can't find a good way to make my previous solution work. Purely because I don't have static pages as url paths. Also I am not sure how best to approach this as I now have controllers rather then aspx pages. I have looked at the MVCSitemapprovider, but that does not work off a database, it needs a sitemap file. I need control of changing user persmissions on the fly. Any thoughts/suggestions/pointers would be greatly appreciated.

    Read the article

  • Validation firing in ASP.NET MVC

    - by rkrauter
    I am lost on this MVC project I am working on. I also read Brad Wilsons article. http://bradwilson.typepad.com/blog/2010/01/input-validation-vs-model-validation-in-aspnet-mvc.html I have this: public class Employee { [Required] public int ID { get; set; } [Required] public string FirstName { get; set; } [Required] public string LastName { get; set; } } and these in a controller: public ActionResult Edit(int id) { var emp = GetEmployee(); return View(emp); } [HttpPost] public ActionResult Edit(int id, Employee empBack) { var emp = GetEmployee(); if (TryUpdateModel(emp,new string[] { "LastName"})) { Response.Write("success"); } return View(emp); } public Employee GetEmployee() { return new Employee { FirstName = "Tom", LastName = "Jim", ID = 3 }; } and my view has the following: <% using (Html.BeginForm()) {%> <%= Html.ValidationSummary() %> <fieldset> <legend>Fields</legend> <div class="editor-label"> <%= Html.LabelFor(model => model.FirstName) %> </div> <div class="editor-field"> <%= Html.DisplayFor(model => model.FirstName) %> </div> <div class="editor-label"> <%= Html.LabelFor(model => model.LastName) %> </div> <div class="editor-field"> <%= Html.TextBoxOrLabelFor(model => model.LastName, true)%> <%= Html.ValidationMessageFor(model => model.LastName) %> </div> <p> <input type="submit" value="Save" /> </p> </fieldset> <% } %> Note that the only field editable is the LastName. When I postback, I get back the original employee and try to update it with only the LastName property. But but I see on the page is the following error: •The FirstName field is required. This from what I understand, is because the TryUpdateModel failed. But why? I told it to update only the LastName property. I am using MVC2 RTM Thanks in advance.

    Read the article

  • Ajax comments form in ASP.NET MVC2, howto?

    - by Artiom Chilaru
    I've been playing around with different aspects of MVC for some time now, and I've reached a situation where I'm not sure what would be the best way to solve a problem. I'm hoping that the SO community will help me out here :P I've seen a number of examples of Ajax.BeginForm on the internet, and it seems like a very nifty idea. E.g. you have a dropdown where you select a customer - and on selecting one it will load this client's details in some placeholder on the page. This works perfectly fine. But what to do if you want to tie in some validation in the box? Just hypothetically, imagine an article page, and user comments in the bottom. Below the comments area there's an ajax-y "Add comment" box. When a user adds a comment, it will appear in the comments area, below the last comment there. If I set the Ajax.BeginForm to Append the result of the call to the Comments area, it will work fine. But what if the data posted is not valid? Instead of appending a "successful" comment to the comments area I have to show the user validation errors. At this point I decided that the area INSIDE the Ajax.BeginForm will be inside a partial, and the form's submits will return this partial. Validation works fine. On each submit we reload the contents inside the form element. But how to add the successful comment to the top? Other things to consider: The comment form also has a "Preview" button. When the user clicks on Preview, I should load the rendered comment into a preview box. This will probably be inside the form area as well. I was thinking of using Json results instead. When the user submits the form, the server code will generate a Json object with a Success value, and html rendered partials as some properties. Something like { "success": true, "form": "<html form data>", "comment": "successful comment html to inject into the page" } This would be a perfect solution, except there's no way in MVC to render a partial into a string, inside the controller (separation of context, remember?). So.. what should I do then? Any "correct" way to implement this? Anyone???

    Read the article

  • ASP.NET MVC: Html.Actionlink() generates empty link.

    - by wh0emPah
    Okay i'm experiencing some problems with the actionlink htmlhelper. I have some complicated routing as follows: routes.MapRoute("Groep_Dashboard_Route", // Route name "{EventName}/{GroupID}/Dashboard", // url with Paramters new {controller = "Group", action="Dashboard"}); routes.MapRoute("Event_Groep_Route", // Route name "{EventName}/{GroupID}/{controller}/{action}/{id}", new {controller = "Home", action = "Index"}); My problem is generating action links that match these patterns. The eventname parameter is really just for having a user friendly link. it doesn't do anything. Now when i'm trying for example to generate a link. that shows the dashboard of a certain groep. Like: mysite.com/testevent/20/Dashboard I'll use the following actionlink: <%: Html.ActionLink("Show dashboard", "Group", "Dashboard", new { EventName_Url = "test", GroepID = item.groepID}, null)%> What my actual result in html gives is: <a href="">Show Dashboard</a> Please bear with me i'm still new at ASP MVC. Could someone tell me what i'm doing wrong? Help would be appreciated!

    Read the article

  • Export the datagrid data to text in asp.net

    - by SRIRAM
    Problem:It will asks there is no assembly reference/namespace for Database Database db = DatabaseFactory.CreateDatabase(); DBCommandWrapper selectCommandWrapper = db.GetStoredProcCommandWrapper("sp_GetLatestArticles"); DataSet ds = db.ExecuteDataSet(selectCommandWrapper); StringBuilder str = new StringBuilder(); for(int i=0;i<=ds.Tables[0].Rows.Count - 1; i++) { for(int j=0;j<=ds.Tables[0].Columns.Count - 1; j++) { str.Append(ds.Tables[0].Rows[i][j].ToString()); } str.Append("<BR>"); } Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=FileName.txt"); Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.text"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); Response.Write(str.ToString()); Response.End();

    Read the article

  • Validate a single property with the Fluent Validation Library for .Net

    - by Blegger
    Can you validate just a single property with the Fluent Validation Library, and if so how? I thought this discussion thread from January of 2009 showed me how to do it via the following syntax: validator.Validate(new Person(), x => x.Surname); Unfortunately it doesn't appear this works in the current version of the library. One other thing that led me to believe that validating a single property might be possible is the following quote from Jeremy Skinners' blog post: "Finally, I added the ability to be able to execute some of FluentValidation’s Property Validators without needing to validate the entire object. This means it is now possible to stop the default “A value was required” message from being added to ModelState. " However I do not know if that necessarily means it supports just validating a single property or the fact that you can tell the validation library to stop validating after the first validation error.

    Read the article

  • Why did the aspnet_client folder come back in ASP.NET 4?

    - by rbeier
    I recently upgraded my MVC 1 project (ASP.NET 3.5) to MVC 2 (ASP.NET 4). I noticed there is now a folder "aspnet_client\system_web\4_0_30319" under the site root. This folder is empty... I'm just wondering if anyone knows why it was created. I remember the aspnet_client folder from the days of .NET 1.1, but I thought it was obsoleted when .NET 2.0 came out. For example, see the answers in these two stackoverflow posts: What is the aspnet_client folder in my ASP.NET website? What is the aspnet_client folder for under the IIS structure? So I'm just curious why it's back. Thanks, Richard

    Read the article

  • How to use ASP .NET dropdown with ajax

    - by Poomjai
    Greeting, I'm beginer of ajax technology and now i need to create two dropdown in MVC project for example: First dropdown has the list of classroom [601,602,603] when i choose one then next dropdown will has the list of student belong to each class room. Now, I already create the repository class that has method GetStudentByClassroomName() and already connect to the database. Can anyone give me a suggestion how to create it or any technology to create the dropdown like this? Thank you very much ^_^

    Read the article

  • Calling a generic function in VB.NET / C#

    - by Quandary
    Question: I want to call a generic function, defined as: Public Shared Function DeserializeFromXML(Of T)(Optional ByRef strFileNameAndPath As String = Nothing) As T Now when I call it, I wanted to do it with any of the variants below: Dim x As New XMLserialization.cConfiguration x = XMLserialization.XMLserializeLDAPconfig.DeserializeFromXML(Of x)() x = XMLserialization.XMLserializeLDAPconfig.DeserializeFromXML(GetType(x))() x = XMLserialization.XMLserializeLDAPconfig.DeserializeFromXML(Of GetType(x))() But it doesn't work. I find it very annoying and unreadable having to type x = XMLserialization.XMLserializeLDAPconfig.DeserializeFromXML(Of XMLserialization.cConfiguration)() Is there a way to call a generic function by getting the type from the instance ?

    Read the article

  • Asp.Net MVC ActionLink

    - by Pino
    Can anyone explain why the following happens? And how to resolve, Visual Studio 2010 and MVC2 <%= Html.ActionLink("Add New Option", "AddOption", "Product", new { @class = "lighbox" }, null)%> Results in /Product/AddOption?class=lightbox <%= Html.ActionLink("Add New Option", "AddOption", "Product", new { @class = "lighbox" })%> Results in /Product/AddOption?Length=7 Thanks

    Read the article

  • why can't asp.net find my textbox?

    - by phunehehe
    Hello, I'm trying to add more fields to the CreateUserWizardStep, here is what I added: <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server"> <ContentTemplate> <table border="0"> <tr> <td align="right"> <asp:Label ID="NickNameLabel" runat="server" AssociatedControlID="NickName">Nick Name:</asp:Label> </td> <td> <asp:TextBox ID="NickName" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="NickName" ErrorMessage="Nick Name is required." ToolTip="Nick Name is required." ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator> </td> </tr> <%-- The default code is left unchanged, but not shown here --%> </table> </ContentTemplate> </asp:CreateUserWizardStep> Then I tried to reference the objects like this protected void NewUserWizard_CreatedUser(object sender, EventArgs e) { CreateUserWizardStep step = NewUserWizard.FindControl("CreateUserWizardStep1") as CreateUserWizardStep; TextBox nickName= step.FindControl("NickName") as TextBox; // insert additional information to the database } The problem is, I'm getting nulls for nickName. Am I using FindControl("") incorrectly?

    Read the article

  • Bind ISet in ASP.NET MVC2

    - by Dmitriy Nagirnyak
    Hi, I am trying to find out what would be the best bind first element of ISet (Iesi.Collection) as a first element. So basically I only have to use some kind of collection that has an indexer (and ISet doesn't) then I can write code like this (which works perfectly well): <%: Html.EditorFor(x => x.Company.PrimaryUsers[0].Email) %> But as the ISet has no indexer I cannot use it. So how can I then bind the first element of ISet in MVC2? Thanks, Dmitriy.

    Read the article

  • Read assembly Guid without locking the DLL in an appdomain in medium trust ASP.Net

    - by ggonsalv
    Is it possible to read the GUID from the Assembly without actually loading it in the current App Domain. Normally Assembly.Load loads the DLL into the app domain. I just want to read the value. The description of the GUID is 'The following GUID is for the ID of the typelib ' if this project is exposed to COM <Assembly: Guid("DEDDE61CD-928E-4ACD-8C25-3B8577284819")> The main thing is I don't want to lock the file so that there are no errors 'Another process is accessing the file' error.

    Read the article

  • problem with RenderOuterTable property for .net 4.0 controls

    - by Mario
    According to the new 4.0 framework overview, one should be able to add the attrib RenderOuterTable="false" to a control that supports the attribute and see css friendly code be spit out - in other words no html tables. To test this, I threw a login control into a basic fresh webpage with the following code: <asp:Login ID="Login1" runat="server" RenderOuterTable="false"></asp:Login> The result? Crappy html table output, which supposedly doesn't happen with this attrib set to false. Here is the output: &lt;table cellpadding=&quot;0&quot;&gt; <tr> <td align="center" colspan="2">Log In</td> </tr><tr> <td align="right"><label for="MainContent_Login1_UserName">User Name:</label></td><td><input name="ctl00$MainContent$Login1$UserName" type="text" id="MainContent_Login1_UserName" /><span id="MainContent_Login1_UserNameRequired" title="User Name is required." style="visibility:hidden;">*</span></td>... Hopefully you get the point. Anyone know how to stop these controls from outputting tables? This is super annoying.

    Read the article

  • Working with images in asp.net MVC ViewMasterPage in design mode

    - by amit.codename13
    While designing a master page i am adding a number of images to it. I have an image tag inside the master page, <img src="../../Content/Images/img19.jpg" class="profileImage" /> When i run my app, the image doesn't show up in the browser because the src path in the page that browser gets is same as in the master page. ie. "../../Content/Images/img19.jpg" But it should have been "Content/Images/img19.jpg" If i correct the src path in master page as <img src="Content/Images/img19.jpg" class="profileImage" /> Then I can see the image in the browser but not in design mode. Any help is appreciated.

    Read the article

  • client side validation in ascx files (user controls) for asp.net mvc

    - by Sefer KILIÇ
    hi, I have a logOn forn in ascx files and I render it as partial. How I can add a clinet side validation to this form, have any idea ? My below code does not work <%= Html.ValidationSummary(true, "Giris basarisiz oldu. Lütfen hatalari düzeltip tekrar deneyin.") %> <% Html.EnableClientValidation(); %> <% using (Html.BeginForm("LogOnProcess", "Account")) { %> <div> <fieldset> <legend>Hesap Bilgileri</legend> <div class="editor-label"> <%= Html.LabelFor(m => m.UserName) %> </div> <div class="editor-field"> <%= Html.TextBoxFor(m => m.UserName) %> <%= Html.ValidationMessageFor(m => m.UserName) %> </div> <div class="editor-label"> <%= Html.LabelFor(m => m.Password) %> </div> <div class="editor-field"> <%= Html.PasswordFor(m => m.Password) %> <%= Html.ValidationMessageFor(m => m.Password) %> </div> <div class="editor-label"> <%= Html.CheckBoxFor(m => m.RememberMe) %> <%= Html.LabelFor(m => m.RememberMe) %> </div> <p> <input type="submit" value="Giris" /> </p> </fieldset> </div> <% } %>

    Read the article

  • asp.net mvc making delete usercontrol information passing on and off

    - by mazhar kaunain baig
    i am creating a generalize deleteusercontrol , my aim is that on the listing page where all the records are listed when the delete is pressed i want to display the acknowledgment on the same page up the list. I had little idea to do that q1) first of all where will i place my deleteusercontrol(in the shared folder?). q2) on and off the deleteusercontrol as the acknowledgment will not be there all the time how would i be doing that on delete press. i don't want to pass any data in the querystring. q3)how would i be passing the records list id and listname to the general deleteusercontrol as it would be same for all the listing

    Read the article

  • FileUpload ASP.NET control not working under Windows 7

    - by YourMomzThaBomb
    I have a User Control that contains a System.Web.UI.WebControls.FileUpload control as well as a button to 'Submit'. When the button is clicked code similar to the following is executed: If FileUploadControl.HasFile Then 'Save the file and do some other stuff End If This code works just fine with Windows XP. However, if I run it from a Windows 7 64-bit machine using IE8 32-bit the HasFile property always returns false and nothing is saved?! Any suggestions/ideas would be greatly appreciated.

    Read the article

  • A potentially dangerous Request.Form value in MVC 2 & ASP.NET 4.0

    - by Veton
    When I trying to send form containing value with xml, I get HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client All approaches I found: <%@ Page ValidateRequest="false" %> in .aspx-file. <pages validateRequest="false" /> in web.config. [ValidateInput(false)] on controller's action. don't help me. Hope for any advice.

    Read the article

  • ASP.NET aspxerrorpath in URL

    - by theog
    I have a site where I use CustomErrors in the web.config to specify a custom error page, and that's working just fine. The custom 404 page is also specified in the IIS configuration (because if it's not, I don't get my custom 404 page). But I have some logic that kicks in if a user gets a 404 that looks at their requested URL and make a navigation suggestion, if appropriate. This logic relies on the aspxerrorpath value. On my development PC, the aspxerrorpath is correctly appended to the URL, like so: http://localhost:3092/FileNotFound.aspx?aspxerrorpath=/badpage.aspx, but on my test site, there's no aspxerrorpath appended to the URL, so all of my custom logic is bypassed and my suggestions don't work. I'm not sure if this is an IIS config issue or something else. The web server is Windows Server 2008 with IIS 7. Any thoughts? Many Thanks.

    Read the article

< Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >