asp.net-mvc

application_start event called multiple times in MVC application

hi, In my MVC application ,I am updating my web.config at runtime through application_start event.So, ideally it should be done only when the application is started.BUT in MY mvc application the application_start event of global.asax is being called multiple times , even when i have not restarted the application. Its being repetadly c...

Validating a SelectList in MVC 2

Hi, I'm not sure what I am doing wrong here, not even sure if I am on the right track. I have a view model and I create a drop down list from it. Here is my view model: public class ApplicationViewModel { public Application Application { get; private set; } public SelectList AccountTypes { get; private set; } p...

How to add HyperLink in ModelState.AddModelError

i want to add a hyperlink in my message like ModelState.AddModelError("_FORM", "Please report this error <a href="asdf.aspx">Click Here</a>"); Im using asp.net mvc 2. How can i do this? ...

What is a reliable way to run time consuming tasks in ASP.NET MVC2

I need reliable way to run 10 different tasks simultaneously. For instance the first one would be sending emails, while the next one is cleaning rows from a specific table... so on an so forth. I've used the Thread class and while it works well on my development machine (VS2010 internal web server) non of these threads seems to be worki...

How to remove returnurl from url?

I want to remove "returnurl=/blabla" from address bar when a user want to access to a login required page. Because I'm trying to redirect the user to a static page after login to do some selections. How can I do that? ...

Prevent returned view being cached when an error occurs

Is there a way to to prevent a page from being cached when the OutputCache attribute has been set on an action? This is so that, when the page is subsequently hit, it will not store the generic error page that was returned previously. An example below shows an instance where it would be desirable for the application not to cache the pa...

MVC RenderPartial jQuery problem with selector (ID).

I have this infoflyout.ascx <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %> <script type="text/javascript"> $(document).ready(function () { $("#flyoutdialog").dialog({ autoOpen: false }); $('#opener').click(function () { $("#flyoutdialog").dialog('open'); retur...

how to check cookie enabled for the browser or not

how to check cookie enabled for the browser or not in ASP.NET (MVC) ...

Make new MVC AJAX InsertionMode

Hello, I'd like to extend my MVC2 project with a new kind of insertion mode, because the current InsertionMode.Replace doesn't fit my needs, as it just replaces/inserts the content into the parent node, but I would need the parent node to be replaced as well (messing around with table rows). Currently I have the original replace method...

ASP.net Package and Deployement Configuration Difference?

what is the difference between in configuration (i.e Release,Debug, All configuration) in asp.net package and deployment? ...

MVC RedirectToAction from one controller to another - View is not displayed issue

I have a controller in which is do some checks. If for one reason or another and exception occurs I want to display the error messages in another view in another controller. This is how my exception handler looks catch (Exception ex) { string infoMsg = "Delete the user and recreate is with an appropriate username...

Display Image in mvc view

Hi I have am working in MVC, I want to display image which is available in in System.Drawing.Image object. Please give me some solution for this. Thanks & Regards Munish Gautam ...

Programmatically invoking asp.net mvc controller action from webforms page

Is it possible to invoke an action on asp.net mvc controller programmatically from a classic webforms page that is not handled by MVC but running in the same web application? We have a mixed asp.net web application: webforms for page rendering and mvc for ajax calls. But we want to render some MVC views from webform page on the server v...

ASP.NET MVC custom membership for beginners

Hi, I am creating my own website and blog and I want for first time just me in database (my name and password) and maybe later some registration for others but first log in just for me and administration with authorization. I don´t want to use Membership from MS. I want try to create my own from start so I am looking for guide for beginn...

read the Membership/Profile/Role provider's connection from external file other then web.config

hi, In my MVC application I am reading the Membership/Profile/Role provider's connection string from web.config. In web.config I am writing this connection string at runtime. Now the problem is, if I update the web.config at run time, then each time my application will get restarted, it will slow down my application. So I want to rea...

Shared 'per request' storage for ASP.NET MVC controllers

In a standard ASP.NET webforms project, if I have a several user controls on a page that require the same data I'd tend to have the first user control put the data in the HttpContext.Current.Items collection so it was available for all the others. What's the nearest equivalent to this for a ViewResult on an MVC controller that's used mu...

handling errors in form on jquery ui dialog

i am using jquery ui dialog and displaying a form: $("#detailView").dialog({ resizable: false, height: 'auto', autoOpen: false, width: 1000, modal: true, buttons: { 'Close': function () { closeModalPopup(); } } }); i have a button inside my form (not the dialog buttons). When i ...

what is CAPTCHA for security purpose?

Can anyone tell me what does CAPTCHA do as far as security issue is concerned?Registration form of many sites have this field but how it works? ...

How can I read the header of table in Excel and display it automatically on a ASP.NET MVC page?

Hello, (finally) I was able to read a Excel file located in the App_Data folder and display it on a view. Now I'd like to push the logical further. Instead of writing the following header tags on my page by hand, <tr> <th>ID</th> <th>First Name</th> <th>Last Name</th> </tr> I'd like to be able to read the first row on my...

.NET 4.0, MVC 2, Entity Framework 4, and Repository Pattern

I am new to both MVC as well as Entity Framework, but I want to do my next project using those technologies. I went through the NerdDinner tutorial at http://nerddinnerbook.s3.amazonaws.com/Part1.htm. NerdDinner uses Linq to Sql and uses the Repository pattern to manage data access. NerdDinner is written so well that I wanted to use it...