asp.net-mvc

Using OpenID (via DotNetOpenAuth) along with user roles and other Membership Provider features in ASP.NET MVC

I'm building an ASP.NET MVC site where I want to use DotNetOpenAuth to implement OpenID login (I'm completely dropping username/password-based login). So far, I've been writing my code for the default username/password system with the ASP.NET Membership Provider, utilizing the roles system, the profile system, and the basic registration...

How do I show an authorization error message in an ASP.NET MVC 2 application?

I'm using the Authorize attribute to filter controller actions based on user roles, but if an unauthorized action is attempted, the user is redirected back to the login page. As I user I would find this confusing and irritating. How can I instead show an error message informing the user they need certain roles, and remain on the view w...

Url.Action how to convert utf-8?

Hi, <a href="<%=Url.Action("Search","Home",new{ value = "Şiir" }) %>">Şiir</a> domain/Search/%C5%9Eiir How can I convert it to utf-8? domain/Search/Şiir ...

ASP MVC Validation using RegularExpression for Combo Box

I have a combo box like this <select name="Type" id="Type" > <option value="0">--Select--</option> <option value="Open Ended">Open Ended</option> <option value="Property">Property</option> </select> and my MVC validator contains this [Required(ErrorMessage = "Required Field")] [RegularExpression(@"^[^0]+", ErrorMessage = "Pleas...

Application cant be found by IIS!

HI there, I have a problem with my MVC 2 ASP.NET running on IIS 7.5 Server Error in Application "ORDERS"Internet Information Services 7.5 Error Summary HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. Detailed Error Information Module I...

How do you implement "Site under maintenance" for Windows Azure Web Site?

Hi folks, In one of our ASP.NET Web site solutions I need to roll out an update that might take reasonable time. It spawns multiple Windows Azure Workers and projects and so simple Deployment Swap is ruled out. Essentially I'm just thinking about way to redirect all web requests to a "site is under maintenance" page for some time, give...

An opinionated web framework on top of ASP .NET MVC

By opinionated I mean that the framework will lock you to follow certain conventions or technologies or architectures. Something similar to Rails or Django. This will make building deeply-integrated plugins possible. One of the major advantages of using Rails/Django is the gems/plugins. As you know, you'll find a gem for everything: adm...

closing jquery colorbox before load breaks jquery,....

I am using jquery colobox to show the popup in my asp.net mvc(C#) application. Following is the line to call colorbox: $.fn.colorbox({ href: '/User/Detail', width: "1200px", height: "560px", title: "User Detail", overlayClose: false }); UPDATE(using the below with the latest version): $.colorbox({ href: '/User/Detail', width: "1200p...

Cannot convert from HttpContextBase to HttpContextBase

With the following code (using Moq 4.0.10501.6): HomeController controller = new HomeController(); ActionResult result = _controller.Index(); Mock<HttpResponseBase> response = new Mock<HttpResponseBase>(); Mock<HttpContextBase> httpContext = new Mock<HttpContextBase>(); httpContext.Setup(x => x.Response).Returns(response.Object); Moc...

Strange compilation error in Entity Framework and MVC application.

I've just created a new MVC 2 application that references both an entity model library and a services library, and all compiles fine without running the app, but when I try running it, I get the following runtime error" Compiler Error Message: CS0012: The type 'System.Data.Objects.DataClasses.EntityObject' is defined in an assembly that...

How can I achieve the equivalence of RegisterClientScriptBlock using an ActionLink?

I am busy trying to write an Html.DatePickerFor helper, but say I want to use a custom date picker that has JavaScript dependencies, how could I expand my CustomActionLink call to, before rendering content offered by the link, ensure that e.g. jQuery and my own scripts, are on the view being rendered. In a WebForms app, I would use Regi...

Do ASP.Net MVC Portable areas work with Umbraco?

I have an Umbraco website that I want to extend. I feel that ASP.Net MVC is the way to go for the extension I'm writing - I particularly like the idea of a Portable Area from MVCContrib. What I'm wondering is, how straightforward would it be to incorporate the Portable Area into Umbraco without recompiling the source? More generally, is...

Ninject how to access kernel to create instances?

I am new to ninject using ninject 2.0. My application is hosted in asp.net mvc. Now i don't know how to access kernel created in my class library. I think i should create kernel in global.aspx and load all modules in it. But how can i make it available throughout application? protected void Application_Start() { Regist...

Can't connect to asp.net development server in Visual studio 2010

I'm working on my asp.net mvc project but when i try to run my project it show the error which is " unable to connect to the asp.net development server " but my server icon on the taskbar is also connect, I try to set specific port but there is still a problem. any suggestion, Thank you ...

Asp.net mvc application authentication lost every 20-50 seconds

hi, My asp.net mvc application, requires me to login every 20-50 seconds, i contacted the hosting provider, who says its due to recycle of pool. i have added following code to web.config. <sessionState mode="StateServer" stateConnectionString="tcpip=localhost:42424" cookieless="false" timeout="20"/> the problem is not solved, how do...

jquery validation with resource files for multiple languages

I am using resource files in an ASP.NET MVC 2 web application and was using Jquery Validation but could not work how to use the resource files for the validation messages. Anyone able to help? ...

Direct user to thirtd party site from Controller in Asp.NET MVC.

Hi, I need to direct user to Paypal site for payment . Is there a way to achieve this from the controller with out the paypal site opening in a new browser?. Right now I am using Process.Start(url) but would like to find out a better way to d o this preferably with our AJAX and in the same way Return view() behaves. Thanks in advance...

Strongly typed Update and Create controller actions.

I have example code in which the signature of the Create action menthod in the controller looks like this: [HttpPost] public ActionResult Create(JobCardViewData viewData) I have just created a new MVC application and the same signature looks like this: [HttpPost] public ActionResult Create(FormCollection collection) ...

Is it possible to cache by membership role in asp.net mvc?

We have a bunch of pages that get really high traffic, and as such we have the following in web.config: <caching> <outputCacheSettings> <outputCacheProfiles> <add name="defaultCache" duration="900" varyByParam="*" location="Any"/> </outputCacheProfiles> </outputCacheSettings> </caching> and the following attribute on...

Using the generic type 'System.Collections.Generic.List<T>' requires 1 type arguments

What does it mean? I used a list of list in asp.net mvc and sent them through viewdata of ActionResuls to retrieve it in views. But when I change it to list of list the it give me an error of HttpWebException. When I check it inside the immediate window, it tells me that the error is: Using the generic type 'System.Collections.Generic....