asp.net-mvc-2

How do I go about Authorization in MVC 2?

南笙酒味 提交于 2020-02-08 07:37:11
问题 How do I go about Authorization in MVC 2? I want to use AD groups/roles rather than the default that is provided. That seems to be "AspNetSqlMembershipProvider". Anyway I put : [Authorize(Users = "username")] public ActionResult About() { ViewData["Welcome"] = "Welcome About"; return View(); } And then loading the page gives me: The connection name 'ApplicationServices' was not found in the applications configuration or the connection string is empty. Line 34: <providers> Line 35: <clear />

How do I go about Authorization in MVC 2?

て烟熏妆下的殇ゞ 提交于 2020-02-08 07:37:06
问题 How do I go about Authorization in MVC 2? I want to use AD groups/roles rather than the default that is provided. That seems to be "AspNetSqlMembershipProvider". Anyway I put : [Authorize(Users = "username")] public ActionResult About() { ViewData["Welcome"] = "Welcome About"; return View(); } And then loading the page gives me: The connection name 'ApplicationServices' was not found in the applications configuration or the connection string is empty. Line 34: <providers> Line 35: <clear />

resource sharing in asp.net mvc

心不动则不痛 提交于 2020-02-08 03:01:47
问题 I have 2 asp.net mvc2 projects in a solution. One is normal site for visitors use and the other one is admin back-end which is going to be separated by sub-domains like test.com and admin.test.com. The scenario is like admin will add a new item(e.g product) with image and test.com will use that image to display product. Both application are sharing one db. so there is no problem to get the item details that is coming from the db. but for item image that has been uploaded in admin directory

ASP.NET MVC application level soft coded settings

半腔热情 提交于 2020-02-06 05:46:22
问题 I am working on a ASP.NET MVC 2.0 Multi-Presentation web application which would use a common codebase to support different websites. These websites would differ in following aspects: Each website will have their own headers, footers, images, CSS etc (I guess website specific Master Pages) Some of the UI elements could be different based on soft-coded settings at website level What is the best approach to handle these requirements? Should I be storing these website level soft-coded settings

MVC Dynamic Views From Url Slug

ぃ、小莉子 提交于 2020-02-02 13:44:26
问题 I am building my first .NET MVC web application and loving the simplicity and flexibility. I have however come to my first stumbling block. I have a list of items and if you are not logged in you will see a preview link I would like the link to direct to something like below: /preview/unique-slug The view should then allow me to display the contents from the database (essentially a details page) I am not sure how to approach this nor what I should be Google'ing as the results I got were poor.

MVC Dynamic Views From Url Slug

你离开我真会死。 提交于 2020-02-02 13:43:45
问题 I am building my first .NET MVC web application and loving the simplicity and flexibility. I have however come to my first stumbling block. I have a list of items and if you are not logged in you will see a preview link I would like the link to direct to something like below: /preview/unique-slug The view should then allow me to display the contents from the database (essentially a details page) I am not sure how to approach this nor what I should be Google'ing as the results I got were poor.

Error when creating crystal report in asp.net mvc2

只愿长相守 提交于 2020-02-02 13:27:29
问题 I made a report using crystal report and in the page load I am writing this protected void Page_Load(object sender, EventArgs e) { ReportDocument crystalReport = new ReportDocument(); crystalReport.Load(Server.MapPath("CrystalReport.rpt")); crystalReport.SetDatabaseLogon ("amit", "password", @"AMIT\SQLEXPRESS", "TestDB"); CrystalReportViewer1.ReportSource = crystalReport; } and when runing the page I found this error. CS0433: The type 'CrystalDecisions.Web.CrystalReportViewer' exists in both

Error when creating crystal report in asp.net mvc2

故事扮演 提交于 2020-02-02 13:25:30
问题 I made a report using crystal report and in the page load I am writing this protected void Page_Load(object sender, EventArgs e) { ReportDocument crystalReport = new ReportDocument(); crystalReport.Load(Server.MapPath("CrystalReport.rpt")); crystalReport.SetDatabaseLogon ("amit", "password", @"AMIT\SQLEXPRESS", "TestDB"); CrystalReportViewer1.ReportSource = crystalReport; } and when runing the page I found this error. CS0433: The type 'CrystalDecisions.Web.CrystalReportViewer' exists in both

A default document is not configured for the requested URL, and directory browsing is not enabled on the server

試著忘記壹切 提交于 2020-01-28 14:10:33
问题 I have just deployed my asp.net mvc-2 website to a server (using dotnetpanel). But getting this error A default document is not configured for the requested URL, and directory browsing is not enabled on the server. What settings I needs? Its dotnetpanel based hosting server. 回答1: Which version of IIS is your host running? One thing to try is to put a dummy default.aspx file in the root folder (this will not be used when MVC is working, but can get rid of this problem). 回答2: The answer marked

trying to make an MVC EditorTemplate for a Bool that renders a DDL with True or False

穿精又带淫゛_ 提交于 2020-01-25 09:53:04
问题 I am making an MVC EditorTemplate for the bool data type that will render a drop down list with options True or False, AND set the selected value to the value of the Model. The DDL renders but it's not being set to the value of the model. What am I missing here? Here is my view code: <%:Html.EditorFor(model => model.Association.Active, "Bool")%> Here is my template code: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<bool>" %> <% string[] values = new string[2]; values[0]