asp.net-mvc

ASP.net MVC How to run multiple instances of the same app at the same time in different subdomains?

ASP.net MVC How to run multiple instances of the same app at the same time in different subdomains? I have a dozen or so subdomains. sub1.website.com sub2.website.com and the folder structure like this \website\sub1 \website\sub2 If i need to run the same app for all of the subdomains, what would be the best appoach? Host is in t...

jQuery validation plugin doesn't seem to work ....

ASP.NET MVC's Html.BeginForm() seems to work with jQuery validation plugin but the validation plugin doesn't seem to work with a form which i've added to a page.... This works, <% using (Html.BeginForm("Login", "Registration", FormMethod.Post, new { id = "Loginform" })) {%> <fieldset> <legend>Login</legend> ...

What to choose (in ASP.NET MVC) for a new webshop project?

What to choose for the foundation of a new webshop project? I have narrowed down my options into using ASP.NET MVC, so that is a must. That leaves me with: Rob Conery's Kona (not being updated anymore but all in all seems a good foundation, though with a huge amount of features) MVC MusicStore by Jon Galloway (very simple, in fact it c...

Authorization security of ASP.NET Forms authentication

I'm using Forms authentication in ASP.NET MVC website and I store user account login name in AuthCookie like this: FormsAuthentication.SetAuthCookie(account.Login, false); I want to ask if there is a possibility that user on client side will somehow manage to change his login name in AuthCookie and thus he will be for example imperson...

how do I get the form data in a javascript object so I can send it as the data parameter of an $.ajax call.

How to return json after form.submit()? <form id="NotificationForm" action="<%=Url.Action("Edit",new{Action="Edit"}) %>" method="post" enctype="multipart/form-data" onsubmit='getJsonRequestAfterSubmittingForm(this); return false;'> <%Html.RenderPartial("IndexDetails", Model);%> </form> $.ajax({ url: '<%=Url.Actio...

Asp.Net MVC Not Duplicate forms when Edit/Add

When we have anything that requires user input (Eg adding a product to a database) the Edit screen looks the same as the add screen. When using MVC .Net how do you handle this? Do you return the same view? Just adjust the model to reflect the change? ...

how to display selected value in drop down list in asp.net mvc?

i want to display selected value in drop down list . the value comes from the data base. for ex suppose we want to update user profile then value for gender which is previously provided by the user should get displayed as selected value. the code that i used to display is <% string val = Convert.ToString(Model.gender); ViewData["gen"...

INSERT stored procedure does not work?

Hello, I'm trying to make an insertion from one database called suspension to the table called Notification in the ANimals database. My stored procedure is this: ALTER PROCEDURE [dbo].[spCreateNotification] -- Add the parameters for the stored procedure here @notRecID int, @notName nvarchar(50), ...

Can you have a log file per user with Enterprise Library 5 in Asp.net Mvc 2?

There were 2 solutions suggested so far Environment variables using %username% in the filename section, and low level unmanaged code to accomplish it. Environment variables would be susceptible to pulling back only the user that is running the app (the server process login), not the form's login validated username or userGuid. Has this ...

delete operation - asp.net mvc - general feedback - styling issue

Hi, It is bad practise to perform a delete operation via get request so I have implemented a delete 'post' as asp.net mvc does only support post + get requests (as far as I know). Please note that I try to avoid javascript/jquery where I could easily perform delete requests (even puts). I have placed forms on the page for each delete ...

Making a drop down list readonly but still submitting its value

I am using the Html.DropDownList helper in ASP.NET MVC and I would like to make it read-only. Unfortunately, I also need it to submit its value on a form post. I have found (through a similar question on SO) that using the below format will make the drop down read-only but it will not provide access to the control's value within the co...

ASP.NET MVC vs. Jquery/AJAX (Where to draw the dividing line?)

I am learning MVC and I understand the basics now. It is very good for CRUD pages and has built in HTTP methods to post/get edits/updates. That is nice. This is all very testable by just creating a new controller and testing it. But I was thinking about other web page scenerios when using MVC. What about a page that has 2 listboxes that...

Getting the validation metadata for built in validators

How do you get the validation metadata for the built in validation attributes? I'm trying to implement a word count/character count on a form giving the remaining number allowed. As I am implementing the word count validation and metadata myself (adding it into AdditionalValues) I can access this fine, but having spent ages looking I ca...

MVC: User Message Stack implementations

How would you implement a user message stack in ASP.Net MVC? (you set messages for the user in any place inside your app. and they are shown as hints of your app to the user anywhere inside the app) I want to hear your ideas and thoughts. How would you do it? e.g.: ...

ASP.NET MVC - ViewModels For Edit

Is it generally a good practice to have both view and edit models for an MVC app? Meaning, I wouldn't want validation attributes on a view model since it's basically read-only. ...

ASP MVC Set RadioButton From Database

Hello All, I have what should be an easy question for you today. I have two radio buttons in my view: Sex: <%=Html.RadioButton("Sex", "Male", true)%> Male <%=Html.RadioButton("Sex", "Female", true)%> Female I need to select one based on the value returned from my database. The way I am trying to do it now is: ViewData["Sex"] = data...

Setting auth cookie timeout length based on role in ASP.NET

I want to allow admins to be logged in for longer than normal users. I don't see a hook for setting the cookie timeout programmatically or in a role-based way. Is this possible in ASP using Forms Authentication? Thank you in advance. ...

WCF 4.0 & Sync Framework 2.0 & Entity Framework 4.0 & ASP.NET MVC 2.0 & auto generated code

Hello, I have to use Sync Framework 2.0 in our WPF app that will contain SQL Compact 3.5 and will synchronize with SQL Server 2008. I followed this video : http://download.microsoft.com/download/6/7/3/6730f0e7-a649-4656-96ab-150c7501a583/IntroToSyncServicesADODetNet_HighQuality.wmv. But instead DataSet I've used EntityFramework 4...

ASP.NET Mvc 2 How do you launch client side validation from inside javascript?

Is there a function for ASP.NET MVC 2 built in data annotation javascript validation that performs the functionality of Jquery.Validate's isValid()? I'd like to check if my fields are valid prior to using jquery ajax to send data to the server? Any suggestions? Thank You. ...

Best practice for structuring a new large ASP.NET MVC2 plus EF4 VS2010 solution?

Hi, we are building a new web application using Microsoft ASP.NET MVC2 and Entity Framework 4. Although I am sure there is not one right answer to my question, we are struggling to agree a VS2010 solution structure. The application will use SQL Server 2008 with a possible future Azure cloud version. We are using EF4 with T4 POCOs (mode...