asp.net mvc 3 - VS2010 Code First MVC3 SQL default Logfile.ldf name format ignored, creates second logfile_log.ldf file

Using VS2010 code first and SQL Server 2008r2 with an MVC3 webapp, the SetInitializer creates a db as expected when missing or on model changes.The db created has the filename format database.mdf and the **logfile database.ldf (can this default "name.ldf" format be changed to "name_log.ldf"?).When opening the database with VS2010 server explorer (double-clicking the db in solution explorer), the VS2010 creates a new second logfile formatted database_log.ldf.I can now browse the database in VS2010 server explorer, but can no longer debug, dropcr...Read more

asp.net mvc 3 - How can i append partial view result in to div?

I have a div id="comments"in this i am displaying 10 comments at a time. when user want to view next comments, i have provided one button that will collect next 10 comments. for this next comment i have created partial view to display remaining 10 comments into another div morecomments.My problem is when i am displaying next 10 comments its showing me all 20 comments but whole comments div is getting refreshed, how to prevent loading whole comment div.My code is here:<div id="comments"> // Display Comments <div id="moreButton"> ...Read more

asp.net mvc 3 - MVC3 Url.Abs returns domain at Azure, not the CNAME record at domain registrar

I have a Windows Azure application at http://[some GUID].cloudapp.net.I have used a CNAME record at GoDaddy to point mydomain.com to this application. Everything works fine but one thing. I send emails from this application and embed links to the site using@Url.Abs(Url.Action("Action", "Controller"))Url.Abs always prepends the http://[some GUID].cloudapp.net domain, not mydomain.com. I haven't found an overload to this helper that lets me pull my domain name out of the web.config or something like that. How do I tell MVC3 to use mydomain.co...Read more

asp.net mvc 3 - ObjectStateManager vs ApplyCurrentValues when updating an entity?

I know that using ObjectStateManager just results in 1 trip to the database, but a larger update statement and ApplyCurrentValues results in 2 trips to the database, one to retreive the entity and one to update it, so what are the pros and cons of each also, how does issuing the following statement know that I want to update that current record, I know it has something to do with loading it into context, but not sure how it works.[HttpPost]public ActionResult Edit(Movie movie){ (from m in _db.Movies1 where m.Id == movie.id select m)....Read more

asp.net mvc 3 - VS2012 How to add external javascript to packages.config

I'm new to the concept of packages.config and NuGet so feel free to correct me if my understanding is off. I created a new web project in VS2012 and I saw that packages.config was there to manage the javascript files. I used the NuGet package manager to add the metro ui package and it added version 2.0However, the latest version is 3.0 and that's the one I would like to use. I tried deleting 2.0, replacing it with 3.0 and updated the package.config file with the corresponding verision number. But every time I open the project, it tries to overr...Read more

asp.net mvc 3 - dropdownlist set selected value in MVC3 Razor

Here is my model:public class NewsCategoriesModel { public int NewsCategoriesID { get; set; } public string NewsCategoriesName { get; set; }}My controller:public ActionResult NewsEdit(int ID, dms_New dsn) { dsn = (from a in dc.dms_News where a.NewsID == ID select a).FirstOrDefault(); var categories = (from b in dc.dms_NewsCategories select b).ToList(); var selectedValue = dsn.NewsCategoriesID; SelectList ListCategories = new SelectList(categories, "NewsCategoriesID", "NewsCategoriesName",selectedValue); // ViewBag.N...Read more

asp.net mvc 3 - open ssrs report in an iframe

I have developed a website which runs at SSL (https). I want to open some SSRS reports at the website in an iframe. But it is not opened since browsers say that "Blocked loading mixed active content" in the browser's console.If I hit report's URL in another tab or another browsers window then it opens.Also if I run my website at http only then browser opens the report in the iframe perfectly at the website.I think this problem is arises since website runs on https and report url is http only.What can I do to resolve this issue without change in...Read more

asp.net mvc 3 - Newline in a <pre> element in internet explorer 7

I have the following code in my ASP.NET MVC 3 project:<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script><script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>... <pre>@Html.ValidationSummary()</pre>The validationsummary shows the errormessages that are specified in my model. And the model gets the errormessages out of a resource file..In 1 of the errormessages I use newlines (shift + enter).These newlines are show...Read more

asp.net mvc 3 - How can I add new method in Swagger UI?

I'm new to Swagger API so does in ASP.Net, I would like to know if how can I add new HTTP methods(e.g. GET, POST, PUT, DELETE) on the UI. It only contains 6 methods as a default. I would like to add like another GET method. So, any help?Controllerusing System;using System.Collections.Generic;using System.Data;using System.Linq;using System.Net;using System.Net.Http;using System.Web.Http;namespace DemoSwagger.Controllers{ public class ValuesController : ApiController { // GET api/values public IEnumerable<string> Get() ...Read more

asp.net mvc 3 - how to completely redirect all requests for one domain to another?

I have a .net mvc3 website hosted on godaddy (Deluxe 4GH plan) with an SSL and a dedicated IP address (173.201..) recently ,I noticed that there is a strange domain (let's say www.strange-domain.com) which is also pointing to my dedicated IP address (173.201..).that is ,besides my own domain (say ,www.my-domain.com), this new strange domain can also access every part of my site (my application) including the admin area! I really do not want this kind of thing to happen because for the point of SEO ,the search engine may think that two domains ...Read more

asp.net mvc 3 - InvalidCredentialsException using GData API on Azure website; Operation works fine in local debug

I have an MVC4 application that's trying to access Google documents using the C# GData API (https://developers.google.com/gdata/client-cs).The application works as expected when I run the site locally in debug mode from visual studio, but it consistently fails with an InvalidCredentialsException when I publish and run on my Azure website.I've created a minimal MVC4 application to repro this behavior. It deploys to an azure website that's not doing anything except helping me debug this issue. I crammed the essence of the failing operation into...Read more

asp.net mvc 3 - Prevent Last 'N' password reuse - MVC 3

I have a login form that I created in MVC 3 which has a 'change password' view.At the moment there are no restrictions with respect to reusing previous passwords. I understand that I'd need to create a custom password manager as ASP.net has nothing out the box for this. I have a 'previousPassswords' table created.currently , my 'changePassword' controller looks like this: if (ModelState.IsValid) { // ChangePassword will throw an exception rather // than return false in certain failure scenarios. ...Read more

asp.net mvc 3 - How to solve "Key not valid for use in specified state" error when using Azure ACS?

I'm attempting to get OpenID authentication to work in my Azure ASP.NET MVC 3 application and have followed the steps in the MVC 3 Custom Login Sample to do so. Everything works fine in the development environment but not when deployed to the Azure platform.The first issue started with authentication causing the error "Key not valid for use in specified state". The discussion here states that the application needs to be configured to use RsaEncryptionCookieTransform instead of DPAPI which is the default. To try and solve this I added the code f...Read more

asp.net mvc 3 - AWS: EC2 micro, not enough for a .NET MVC 3 application?

I used elastic beanstalk to manage/deploy my .NET MVC 3 application on an EC2 micro instance (has 613 MB memory). It's mainly a static site for now as it is in Beta with registration (including email confirmation) and some error logging (ELMAH).It was doing fine until recently, I keep getting notifications of CPU Utilization greater than 95.00%.Is the micro instance with 613MB memory not enough to run an MVC application for Production use?Added info: Windows Server 2008 R2, running IIS7.5Thanks!...Read more