asp.net-mvc-2

ASP.Net MVC 2 Forms Authentication cookieless = “UseUri” while submit authorization fails

喜夏-厌秋 提交于 2019-12-08 12:50:13
问题 I just started working with ASP.Net MVC 2. I created a new ASP.Net MVC application and created one vehicle controler with a database table connected with LINQ. Then created forms authentication mechanism for the application and tried to use the uri instead of cookies it was working smoothly but when i submit the form by creating a "Create" view from the controler using the utility it just dont work. The autherization got failed and asking to enter the user name and password again.I had

ASP.NET MVC - DisplayFormat attribute

送分小仙女□ 提交于 2019-12-08 11:02:06
问题 In my model i've the MyDate property that has datetime type. I sign the property with the DisplayFormat attribute in this mode: [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy hh:mm}")] public DateTime MyDate { get; set; } in my view: ... <%= Html.EditorFor(model => model.Evento.MyDate)%> ... why if the value of property is '2011-05-03 14:47', in my view (into EditorFor) i see '03/05/2011 02.47' ? The DataFormatString is correct! thanks so much for reply Alberto

How to create a “backdoor” for administrator, to be able to log in as anohter user and see information?

﹥>﹥吖頭↗ 提交于 2019-12-08 10:26:41
问题 I am creating an online survey tool. As an administrator, i would like to see what the users have answered and also be able to answer on their behalf. The system get's a users answers and other information based on his/her username, when they are logged in, using the built in membership provider. There are currently three roles: Administrator, Moderator and Respondent If i would like to show my administrator a list of users, how would it be possible to create a "backdoor" for the

dynamically rendering and posting form elements in ASP.NET MVC 2

烂漫一生 提交于 2019-12-08 10:13:39
问题 I have to render a set of form elements dynamically (based on value selected in some other form element) and post their values back to controller. I have a search form for Hotel Industry which captures hotel related search parameters such as No of Rooms, No of Adults, No of Children, Ages of Children etc. Based on the value selected for “No of Rooms” dropdown, I have to render/show form elements to capture No of Adults, No of Children & Ages of Children FOR EACH ROOM. What would be a better

MVCContrib Portable Area No Intellisense for ViewPage<T>

ぃ、小莉子 提交于 2019-12-08 09:36:55
问题 I am trying out portable areas using MVCContrib. In general these work well and it seems to be a good way to share controllers\views between web projects. The only problem that I'm having is that Intellisense (specifically, for the HtmlHelper) is not working in the view for strongly typed views i.e. ViewPage. The intellisense does work however when the view is a plain 'ol System.Web.Mvc.ViewPage A similar questions has been asked here: MvcContrib Portable Areas View Intellisense? But these

MVC2 model binding w/ many-to-many: at the cusp

ぐ巨炮叔叔 提交于 2019-12-08 09:16:45
问题 I'm an inch away from getting my Create form working. My problem is that some data passed into the form in the view model isn't being sent back in the postback. Models: Game: GameID - int (primary key, auto-incr) GameTitle - nvarchar(100) ReviewText - text ReviewScore - smallint Pros - text Cons - text LastModified - Datetime GenreID - int (foreign key from Genres) Platform: PlatformID - int (primary key, auto-incr) Name - nvarchar(50) GamePlatform (not visible as an EF 4 entity): GameID -

How do I stop an Actionlink redirect and instead popup and redirect using javascript?

半城伤御伤魂 提交于 2019-12-08 09:11:28
This is script what I have currently - <script type="text/javascript"> $(document).ready(function () { $('.RemoveSystem').click(function () { var href = $(this).attr('href'); var answer = confirm("Are you sure you want to delete this system?"); alert(answer); if (answer) window.location = href; }); }); </script> Here is the link which is there for each record and we can delete each system when we click on its delete button - <%= Html.ActionLink("Delete", "RemoveSystem", new { SysNum = item.Id}, new { @class = "RemoveSystem" })%> Now here is the problem the actionlink redirects no matter what

How to create pages with different permissions' views

不想你离开。 提交于 2019-12-08 08:52:28
问题 I need some help to create pages with different views. Don't get me wrong, I don't want anyone to write code for me, I just want to know what I'll need to implement. I'll detail what I need: Ex: Facebook page. If I'm at my profile's page I have one type of view, I can edit all my data, see even not set data and add more information. If I'm visiting a friend's page I can only see what he wants me to and interact with his pages as far as he allowed me. Ex2: One user posted info on some blog. He

ASP.net MVC Validation on mutiple controls

谁说我不能喝 提交于 2019-12-08 08:47:06
问题 I have a strongly typed view which is bound to a ViewModel, one prupose of which is to capture the customers date of birth. To do this I have a number of fields within the ViewModel, defined as follows: public DateTime DOB {get;set;} public int? DOBDay { get { return _DOBDay; } set { _DOBDay = value; SetDOB(); } } public int? DOBMonth { get { return _DOBMonth; } set { _DOBMonth = value; SetDOB(); } } public int? DOBYear { get { return _DOBYear; } set { _DOBYear = value; SetDOB(); } } public

Implementing a job scheduler for ASP.NET MVC

家住魔仙堡 提交于 2019-12-08 08:45:52
问题 I need to execute some activities/jobs in my Web Server, such as indexing some information, organizing some files, and calculating some statistics... I want to preserve the QoS in my Web Server (performance, memory consumption, ...). So I'm thinking of executing an external process for these activities, instead of calling in a thread. Something similar to Apache MPM processer (it launches child processes to process the requests). Do know any best solution to do this? Do you know any library