Search Results

Search found 59301 results on 2373 pages for 'asp net ajax'.

Page 92/2373 | < Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | 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

  • 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

  • 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 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

  • 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

  • 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

  • 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

  • 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

  • Classic ASP result set - ultimate confusion!

    - by Paul
    Consider a simple result set from a mysql query. rs("description") and rs("description").Value should be considered as the same thing. However, depending on how you access them, you get different results (!!) Access rs("description") directly and you are returned a "Field" object. Or, more importantly, use it directly in a call, and you are returned a "Field" object. mydescription = rs("description") + " is the description" Assign it to another variable, and the Value of that object is assigned... mydescription = rs("description") the contents of "mydescription" is a string. Why this difference? At one point in the life of ASP they must have both worked exactly the same, so why have they changed, and how can I change it back?

    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

  • 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

  • Asp.Net MVC custom controls - container

    - by Alan
    Is there a way to make helper in Asp.Net MVC to wrap other html like this: <div class="lightGreyBar_left"> <div class="lightGreyBar_right"> <!--Content--> <h3> Profiles</h3> <div class="divOption"> <%= Html.ActionLinkWithImage("Create new", "add.png", Keys.Actions.CreateProfile, "add")%> </div> <!--Content--> </div> </div> So that helper will render containing divs and content that is passed to helper method as parameter.

    Read the article

  • Looking for a generic handler/service for mongodb and asp.net / c#

    - by JohnAgan
    I am new to MongoDB and have a perfect place in mind to use it. However, it's only worth it if I can make the queries from JavaScript and return JSON. I read another post on here of someone asking a similar question, but not specific to C#. What's the easiest way I can implement a generic service/handler in asp.net/c# that would allow me to interact with mongodb via JavaScript? I understand JavaScript can't call mongodb directly, so the next best thing is what I'm looking for.

    Read the article

  • ValidateInput Attribute Doesn't Seem To Work in ASP.NET MVC

    - by JC Grubbs
    I'm trying to get around the "potentially dangerous Request.Form value" error and I'm having no luck. Yes, yes, I've read all the other StackOverflow related questions and none of them seem to get me closer to an answer. I am using [ValidateInput(false)] on all related controller actions...and I've checked many times. I'm using ValidateRequest='false' in all the related ASPX views. I am using ASP.NET MVC 2 Preview 1, but I don't think that's an issue since the error is being generated lower in the framework; Page.ProcessRequest to be exact. I can't see anything I'm doing wrong, I even set <page validateRequest='false'> in the web.config and that didn't solve it either. HELP!!!!!

    Read the article

  • Home Pages in ASP.NET MVC

    - by Maxim Z.
    I'm trying out ASP.NET MVC, but, after reading a huge tutorial, I'm slightly confused. I understand how Controllers have Actions that URLs are routed to, but how do home pages work? Is the home page its own controller (e.g. "Home") that has no actions? This sounds correct, but how is it functionality implemented without Actions (no Actions means no methods that call the View Engine)? In other words, my question is this: how are home pages implemented (in terms of Controllers and Views)? Could you please provide sample code?

    Read the article

  • ASP.NET MVC 2 - ViewData empty after POST

    - by Alex
    I don't really know where to look for an error... the situation: I have an ASPX view which contains a form and a few input's, and when I click the submit button everything is POST'ed to one of my ASP.NET MVC actions. When I set a breakpoint there, it is hit correctly. When I use FireBug to see what is sent to the action, I correctly see data1=abc&data2=something&data3=1234. However, nothing is arriving in my action method. ViewData is empty, there is no ViewData["data1"] or anything else that would show that data arrived. How can this be? Where can I start looking for the error?

    Read the article

  • asp.net mvc validation must be a number custom error

    - by Para
    Hi, I am new to asp.net and I have a problem. When the users insert in a editor for a decimal field something other than numbers, they get an error "Field name" is not a number. But I don't want them to receive this message I want them to receive another message. I have no problem with this with required and range validators. Is there any way for me to do this? I am not refering necessarily to changing the culture just displaying another message. Thanks.

    Read the article

  • Classic ASP - How to convert string to UTF8 to USC2

    - by Brian G
    I have a problem where I am storing a UTF8 string in SQL Server as USC2, when I pull it out to display on a page with content-type set to UTF-8 it works fine. But I have a third party javascript component which when I pass it the string for the database it renders it as USC2. or not UTF8. Is there a way in ASP to convert this string to UTF-8 after reading it from the database to pass it to the third party component ( obfuscated ) . Hope this makes sense.

    Read the article

  • view state in ASP.NET MVC Application

    - by Shetty
    Hi, I have read that viewstate is not there in asp.net MVC application. I am doing model validation. Now if i have two text boxes on my page,and i am doing required filed validation for both of them in model. This validation is done on server side on click of a button. I will fill one text box and click on submit button. It does the validation and returns the result saying second field is required. At this time value of the first text box is retained. So can you tell me how this text box is retaining the value even after postback?

    Read the article

  • Running ASP.NET MVC application behind a proxy with different root relative path

    - by Wiebe
    Hi All, I'm having trouble with paths in a ASP.NET MVC application that's running behind a proxy. Our IIS Application root path is for example http://server/MyApp/ meaning that all urls using the application root ("~/",Url.Action("MyAction","MyController")) are resolved to "/MyApp" Now we're running behind a proxy server that forwards all requests, but changes the application root to something like this: "/Secury/Proxy/RubbishUrl/MyApp" Because the original url is only available on the client, I thought of creating a cookie with the path prefix, and insert this before each generated URL on the server. Now the question is, what's the best location in code to modify each URL that's resolved/sent to the client (to resources, controller actions, images etc)? Every path in the application is resolved with the MVC methods (Url.Content, Url.Action etc).

    Read the article

  • asp.net forms authentication timing out after 1 minute

    - by user548929
    I'm using ASP.NET MVC 3 with the Authorize attribute, but it keeps kicking me to the logon page after 1 minute, but even though my expiration is set to a very high value, it times out quickly. I check the cookie in my browser and its still there and not set to expire until about a month later, and it's set to be persistent, so I'm not sure why it keeps booting me. It only happens on my published location, locally it works just fine. var ticket = new FormsAuthenticationTicket(username, true, 500000); var encryptedTicket = FormsAuthentication.Encrypt(ticket); var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); cookie.Expires = ticket.Expiration; Response.Cookies.Add(cookie); web.config: <authentication mode="Forms"> <forms loginUrl="~/Account/LogOn" timeout="7200" slidingExpiration="false"/> </authentication>

    Read the article

  • How to access a nested MultiView control in ASP.NET

    - by Eden
    I have an asp.net page with a multiview control nested within another multiview control. In my code behind I'm trying to access the inner most multiview control to set it's ActiveViewIndex. The problem I'm having is that I don't seem to be able to access the control. It's not available directly via this.MySubMultiview. And attempts to use this.FindControl or this.MyOuterMultiView.FindControl doesn't work. Html: ... ... Code behind: MultiView multiAddress = (MultiView)this.MultiViewMain.FindControl("MultiViewAddress"); multiAddress.ActiveViewIndex = 1;

    Read the article

  • Clean way to output values in ASP.NET MVC Views when value is not null

    - by Swoop
    Is there a better way to write the code below? I have quite a few blocks that are similar, and this is making the code in the Viewpage very messy to work with. The data value with the associated label only needs to be output when certain conditions are met, which is almost always if the value is not null. The options I can think is to use a response.write to atleast minimize the usage of the ASP script tags, or to format the webpage is such a way that the label displays with an appropriate n/a type value. <% if (myData.Balance != null) { %> Balance: <%= String.Format("{0:C}", (myData.Balance))%> <% } %>

    Read the article

  • How to manually verify a user against the asp.net memberhip database

    - by Ekk
    I would like to know how I can verify a user's credential against an existing asp.net membership database. The short story is that we want provide single sign on access. So what I've done is to connect directly to the membership database and tried to run a sql query against the aspnet_Membership table: private bool CanLogin(string userName, string password) { // Check DB to see if the credential is correct try { string passwordHash = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "SHA1"); string sql = string.Format("select 1 from aspnet_Users a inner join aspnet_Membership b on a.UserId = b.UserId and a.applicationid = b.applicationid where a.username = '{0}' and b.password='{1}'", userName.ToLowerInvariant(), passwordHash); using (SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString)) using (SqlCommand sqlCmd = new SqlCommand(sql, sqlConn)) { sqlConn.Open(); int count = sqlCmd.ExecuteNonQuery(); sqlConn.Close(); return count == 1; } } catch (Exception ex) { return false; } } The problem is the password value, does anyone know how the password it is hashed?

    Read the article

< Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >