Search Results

Search found 58341 results on 2334 pages for 'learning net'.

Page 100/2334 | < Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >

  • How can I force asp.net webapi to always decode POST data as JSON

    - by Nathan Reed
    I getting some json data posted to my asp.net webapi, but the post parameter is always coming up null - the data is not being serialized correctly. The method looks something like this: public HttpResponseMessage Post(string id, RegistrationData registerData) It seems the problem is that the client (which I have no control over) is always sending the content-type as x-www-form-urlencoded, even though the content is actually json. This causes mvc to try to deserialize as form data, which fails. Is there anyway to get webapi to always deserialize as json, and to ignore the content-type header?

    Read the article

  • Best placement for javascript in Asp.net MVC app that heavily uses partial views

    - by KallDrexx
    What is the best place for javascript that is specific to a partial view? For example, if I have a partial view (loaded via ajax call) with some divs and I want to turn those divs into an accordian, would it be better put the $("#section").accordion() in script tags inside of the partial view, or in a .js file in the function that retrieves that partial view and inserts it into the DOM? Obviously, common methods I will be keeping in a .js file, however I am more talking about javascript very specific to the partial view itself. Most things I find on the net seem to say to put all javascript into a separate .js but nothing addresses the idea of partial views.

    Read the article

  • User can't login after creating them with the asp.net Create User Wizard

    - by Xaisoft
    When I create a user, they can't login until I go into the asp.net configuration and save them. I actually don't change any settings, I just press the save button and then they can login in. What I would like to do is to have the user be able to login once they are created, but I can't seem to get it to work. Here is my code for the CreatedUser method: protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { CustomerProfile adminProfile = CustomerProfile.GetProfile(); string username = ((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName")).Text.Trim(); CustomerProfile createdUser = CustomerProfile.GetProfile(username); createdUser.CustomerID = adminProfile.CustomerID; createdUser.Save(); MembershipUser user = Membership.GetUser(username); user.IsApproved = ((CheckBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("chkActivateUser")).Checked; Roles.AddUserToRole(user.UserName, "nonadmin"); }

    Read the article

  • [C# asp.net mvc or javascript] user-friendly xml sensitization library that html encoding invalid pa

    - by Fox
    I would like to allow my users to submit a subset of xhtml that will be displayed to other users (likely I'll build a schema for it) but I want the server to handle validation more gracefully then hard rejecting invalid submissions.... Instead I'd like the server to Html Encode invalid/harmful parts of the submissions.... (sanitize javascript and css etc.) Is there any library (maybe asp.net mvc 2 has such functionality?) or do I have to develop my own? or maybe there is a javascript library that html encodes invalid parts and I can just have the server only accept that subset?

    Read the article

  • asp.net mvc routing id parameter

    - by parminder
    Hi Experts, I am working on a website in asp.net mvc. I have a route routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); which is the default route. Now I have method public ActionResult ErrorPage(int errorno) { return View(); } now if i want to run this code with http://something/mycontroller/Errorpage/1 it doesnt work. but if i change the parameter name to id from errorno it works. Is it cumpulsory to have same parameter name for this method. Or I need to create seperate routes for such situations. Regards Parminder

    Read the article

  • ASP.NET MVC 2 form submit route issue

    - by Tomaszewski
    Hi, i'm having this issue, in ASP.NET MVC 2 where I'm adding a drop down list on the master page and filling it with data from an abstract master controller. When an option is selected an submit button clicked, it reroutes you to a new page. so lets say the page lives on http://domain.com/landingPage i'm on: http://domain.com/landingPage i select option and submit takes me to http://domain.com/landingPage/Projects/FramedPage i select again and now the post tries to go to: http://domain.com/landingPage/Projects/landingPage/Projects/FramedPage because of the action="" i have set on the form tag. Any ideas on how to go about this? MasterPage: <form method="get" action="landingPage/Projects/FramedPage"> <%= Html.DropDownList("navigationList")%> <input id="navSubmitBtn" class="btnBlue" type="submit" value="Take Me There" /> </form> Projects Controller public ActionResult FramedPage(string navigationList) { ViewData["navLink"] = navigationList; return View(); } The problem i am having is that if I am ON that page

    Read the article

  • ASP.NET Deployment under IIS7/VS2010 as Web Application

    - by adchased
    I transformed my VS2008 ASP.NET Website to a "Web Application" today using VS2010. So now it's possible to build a Deployment Package. A Zip Package which can be direclty imported into IIS7. Usually I added a website in IIS7 called mydomain.com and put everything in its root dir. That worked. However, since I converted to an Web Application, this Application is added beneath my "Website container". Now I'm confused, this is how it actually looks now when I try to open the website: Browsing to mydomain.com says 404 ERROR. Browsing to mydomain.com/mydomain.com opens the actual website, but in a subfolder instead of the root directory. (The Application is named after the Domain) How to make this application the root of the website now? I want the application to run under the mydomain.com ROOT and not some subfolder. Thanks a lot!

    Read the article

  • Regular Expression Help in .NET

    - by Matt H.
    I have a simple pattern I am trying to match, any characters captured between parenthesis at the end of an HTML paragraph. I am running into trouble any time there is additional parentheticals in that paragraph: i.e. If the input string is "..... (321)</p" i want to get the value (321) However, if the paragraph has this text: "... (123) (321)</p" my regex is returning "(123) (321)" (everything between the opening "(" and closing ")" I am using the regex pattern "\s(.+)</p" How can I grab the correct value (using VB.NET) This is what I'm doing so far: Dim reg As New Regex("\s\(.+\)</P>", RegexOptions.IgnoreCase) Dim matchC As MatchCollection = reg.Matches(su.Question) If matchC.Count > 0 Then Dim lastMatch As Match = matchC(matchC.Count - 1) Dim DesiredValue As String = lastMatch.Value End If

    Read the article

  • ASP.NET MVC: Making routes/URLs IIS6 and IIS7-friendly

    - by Seb Nilsson
    I have an ASP.NET MVC-application which I want deployable on both IIS6 and IIS7 and as we all know, IIS6 needs the ".mvc"-naming in the URL. Will this code work to make sure it works on all IIS-versions? Without having to make special adjustments in code, global.asax or config-files for the different IIS-versions. bool usingIntegratedPipeline = HttpRuntime.UsingIntegratedPipeline; routes.MapRoute( "Default", usingIntegratedPipeline ? "{controller}/{action}/{id}" : "{controller}.mvc/{action}/{id}", new { controller = "Home", action = "Index", id = "" } ); Update: Forgot to mention. No ISAPI. Hosted website, no control over the IIS-server.

    Read the article

  • How to force asp.net MVC 2 to redirect to default controller/action

    - by Chris
    In a brand new ASP.NET MVC2 project, I want the user to be redirected to http://<mysite>/home/index rather than http://<mysite>/ We do this with our other sites for tracking purposes, to avoid the scenario where hits to the same default page show up as http://<mysite>/ http://<mysite>/default.aspx How do I accomplish this so that http://<mysite>/ automatically redirects to whatever default controller/action I have set up in my routing? Please note that I am aware the two are functionally equivalent, as the default controller action will be executed either way. I'm just interested in forcing consistent URLs in the browser.

    Read the article

  • Launch Reporting Services Reports from .Net Code

    - by Jeff
    What is the best way to launch reporting services reports from .Net code? One method would be to dynamically build a URL and launch a browser. Something like this: http://server/ReportServer/Pages/ReportViewer.aspx?%2fReport+Directory%2fReport%20Name&FirstParameter=1,2,3&SecondParameter=8/30/2009&rs%3aCommand=Render I don't like how it creates a dependency on the specific URL--especially report parameters which are very likely to change. Is there a better way? The reports I want to link to are in several reporting services projects hosted on one (eventually two) servers.

    Read the article

  • How to validate two properties with ASP.NET MVC 2

    - by CodeMonkey
    Hey folks :-) I'm just getting started with ASP.NET MVC 2, and playing around with Validation. Let's say I have 2 properties: Password1 Password2 And I want to require that they are both filled in, and require that both are the same before the model is valid. I have a simple class called "NewUser". How would I implement that? I've read about ValidationAttribute, and understand that. But I don't see how I would use that to implement a validation that compares two or more properties against eathother. Thanks in advance!

    Read the article

  • RavenDB-Embedded Unstable In Cooperation With ASP .Net Web API Using 2-Tier Architecture

    - by Mohsen Alikhani
    My application is used RavenDB-Embedded Unstable 1.2.2127 that it's intracted with ASP .Net Web API in the separated assemblies. When I use "UseEmbeddedHttpServer = true" on the document store, first time I send a request to RavenDB, it executes properly but when I try for the second time my application displays Raven Studio. However, if UseEmbeddedServer setting be removed then my application will be running without any problems. My RavenDB is configured with the following codes in data tier : this.documentStore = new EmbeddableDocumentStore { ConnectionStringName = "RavenDB", UseEmbeddedHttpServer = true } and implementation of Web.config have these settings in the service tier : <connectionStrings> <add name="RavenDB" connectionString="~\App_Data\RavenDatabase" /> </connectionStrings> Is there a setting I missed?

    Read the article

  • Yield In VB.NET

    - by MagicKat
    C# has the keyword called yield. VB.NET lacks this keyword. I am curious how some of the VB programmers have gotten around the lack of this keyword. Do you implement your own iterator class? Or do you try and code to avoid the need of an iterator? The yield keyword does force the compiler to do some coding behind the scenes. http://blogs.msdn.com/oldnewthing/archive/2008/08/12/8849519.aspx is a good example of that.

    Read the article

  • How to stop .Net HttpWebRequest.GetResponse() raising an exception

    - by James
    Surely, surely, surely there is a way to configure the .Net HttpWebRequest object so that it does not raise an exception when HttpWebRequest.GetResponse() is called and any 300 or 400 status codes are returned? Jon Skeet does not think so, so I almost dare not even ask, but I find it hard to believe there is no way around this. 300 and 400 response codes are valid responses in certain circumstances. Why would we be always forced to incur the overhead of an exception? Perhaps there is some obscure configuration setting that evaded Jon Skeet? Perhaps there is a completely different type of request object that can be used that does not have this behavior? (and yes, I know you can just catch the exception and get the response from that, but I would like to find a way not to have to). Thanks for any help

    Read the article

  • Making .net navigation menu role specific

    - by Ricardo Deano
    Hello all. I'm currently using the good ol login control, .net membership & role providers for a web app I'm building. I have a tabbed navigation menu that I want to make role specific i.e. everyones sees 'Home', one role would be able to see additional tabs, another would be able to see three, etc. Doe sthe allow for such a thing? Has anyone created such a navigation menu and could point a newbie in the right direction? Any help gratefully received.

    Read the article

  • Routing Business Branches: Granular access control in ASP.NET MVC

    - by FreshCode
    How should ASP.NET MVC routes be structured to allow granular role-based access control to business branches? Every business entity is related to a branch, either by itself or via its parent entities. Is there an elegant way to authorize actions based on user-roles for any number of branches? 1. {branch} in route? {branch}/{controller}/{action}/{id} Action: [Authorize(Roles="Technician")] public ActionResult BusinessWidgetAction(BusinessObject obj) { // Authorize will test if User has Technician role in branch context // ... } 2. Retrieve branch from business entity? {controller}/{action}/{id} Action: public ActionResult BusinessWidgetAction(BusinessObject obj) { if (!User.HasAccessTo("WidgetAction", obj.Branch)) throw new HttpException(403, "No soup for you!"); // or redirect // ... } 3. Or is there a better way?

    Read the article

  • Include code in ASP.net

    - by Tom Gullen
    I've got an ASP.net file, and I'm trying to include dynamic code which was easy in classic ASP. Here is what I have tried so far: <%@ Register TagPrefix="TagPre" TagName="header" Src="alg/classes.aspx"%> and <!--#include file="alg/classes.aspx"--> But neither of these seem to work. The content of classes.aspx is: <script runat="server"> ' Square class Public Class square Public sqRows As Integer 'Numbers of rows this square has Public sqCols As Integer 'Number of columns this square has Public sqArray(,) As Integer 'The square array ' Initialise square array to match size of canvas Public Sub initSqArray(ByVal canvCols, ByVal canvRows) ReDim sqArray(canvCols, canvRows) sqRows = canvRows sqCols = canvCols End Sub End Class Thanks for any help!

    Read the article

  • .Net User Messaging System

    - by bechbd
    I am wondering if there is a framework out there for .NET to help me with sending messages to users. I would love to be able to write all my messages to a single repository. I would then like to be able to send these messages out to a user based on preferences that they set. e.g. I would like to be able to send a Notification A out to user A via email and text message and send Notification B to user B via SMS and IM. Any thoughts on if something like this exists or would I need to write it?

    Read the article

  • How to remove a tab attribute in ASP .NET AJAX Toolkit using Regular Expression

    - by Nassign
    I have tried to remove the following tag generated by the AJAX Control toolkit. The scenario is our GUI team used the AJAX control toolkit to make the GUI but I need to move them to normal ASP .NET view tag using MultiView. I want to remove all the __designer: attributes Here is the code <asp:TextBox ID="a" runat="server" __designer:wfdid="w540" /> <asp:DropdownList ID="a" runat="server" __designer:wfdid="w541" /> ..... <asp:DropdownList ID="a" runat="server" __designer:wfdid="w786" /> I tried to use the regular expression find replace in Visual Studio using: Find: :__designer\:wfdid="w{([0-9]+)}" Replace with empty space Can any regular expression expert help?

    Read the article

  • Wrangling Control of HTTP Headers in ASP.NET

    - by Andrew Burgess
    I'm working with ASP.NET MVC3, and I'm trying to get absolute control over my headers because a client application that I'm working with expects a very specific content type. What I'm finding when using Fiddler to examine the HTTP traffic is that the text encoding is being returned as part of the header. For example, the client is expecting application/appname in the Content-Type header, but the server is returning application/appname; charset=utf-8. I think the client is using a strict comparison for checking the type, so I want to be able to specify exactly what is emitted in the headers. Right now I have a custom ActionResult in which I clear the headers and then specify only the content type, but the encoding still seems to be added on. How can I remove the encoding from the Content-Type header?

    Read the article

  • Sending and Receiving data through SOAP web service in .Net

    - by Nikhil Thaker
    I am working on a client - server application and in which I used to send and receive data through SOAP web service. Now after sometimes I have heard from someone that I might lost some data while this process on soap service created in ASP.net. So now I have decided to send and receive data through batches like first I will send List of 50 objects and then next 50 and so on... Now I am new to web services and all. So my question is "Is it true that we can lost some data sometimes while transferring it through SOAP web service?"

    Read the article

  • Generic test suite for ASP.NET Membership/Role/Profile/Session Providers

    - by SztupY
    Hi! I've just created custom ASP.NET Membership, Role, Profile and Session State providers, and I was wondering whether there exists a test suite or something similar to test the implementation of the providers. I've checked some of the open source providers I could find (like the NauckIt.PostgreSQL provider), but neither of them contained unit tests, and all of the forum topics I've found mentioned only a few test cases (like checking whether creating a user works), but this is clearly not a complete test suite for a Membership provider. (And I couldn't find anything for the other three providers) Are there more or less complete test suites for the above mentioned providers, or are there custom providers out there that have at least some testing avaialable?

    Read the article

  • .NET Database Apps: Your Preferred Setup

    - by mdvaldosta
    I'm struggling to settle into a pattern for developing typical database driven apps in C# and Visual Studio. There are so many ways to set them up, using drag/drop datasets and adapters or writing the queries manually in ADO.NET or Linq to SQL, Linq to Entities, to bind or not to data bind etc etc. Where to store the connection string, in app.config or in a method or both etc etc. So many tutorials and all of them are different. Everytime I write something I start hating the way it looks and works, so I scrap it and start over. It's getting a bit tedious. Maybe it's alittle of the OCD in me. Would any of you professional developers out there share your method of setting up and structuring your database logic and maybe some sample code? It's really how to go about organizing the code and the method(s) of interacting with SQL that I'm trying to get into a routine with, one that works and won't get me laughed at by someone reviewing it.

    Read the article

  • ASP.NET - ViewState: empty placeholder generates view state

    - by Budda
    On my web-page I have PlaceHolder, not controls are loaded into it. <asp:PlaceHolder ID="PlaceHolderStatMain" runat="server"> </asp:PlaceHolder> I am looking the ViewState generated for the page, it is the following: <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJLTg1NDkyNTUzD2QWAgIDD2QWAgIND2QWAmYPZBYCAgEPZBYCZg9kFgJmD2QWBmYPFQEYL3N0YXRfc3RhZGl1bS9sZWFndWVfV0VGZAIBDxUBGC9zdGF0X3N0YWRpdW0vbGVhZ3VlX0VFRmQCAg8VARgvc3RhdF9zdGFkaXVtL2xlYWd1ZV9GQ1VkZEuSBUr5LFL6WfCehNBJgjrq0GzwWCWN2qlU70V7LAAb" /> When I set EnableViewState to false: <asp:PlaceHolder ID="PlaceHolderStatMain" runat="server" EnableViewState="false"> </asp:PlaceHolder> The viewstate content was decreased significantly: <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJLTg1NDkyNTUzZGTTn8Y28VwmpE/K7yPPkLFvhrqMdU8THijFW/BMFzk0tQ==" /> Question: how to remove 'useless' viewstate content without disabling viewstate for placeholder himself (I would like other control loaded into placeholder to has viewstate)? Is it possible at all? Any thought are welcome! P.S. I am using ASP.NET 4.0

    Read the article

< Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >