asp.net

User types / role - developers

You have regular user's that use your website/services, they can login to mainsite1, then you have developers, that can not login to mainsite1, but can login to developercenter1. 1) Do you store every type of users into 1 large USER table then assign different roles? or 2) Do you create a completely separate table just for develope...

What's the ASP.NET Webservice request lifecycle?

On a regular aspx page, I have events such as Page_Init, Page_Unload, etc., which occur in a well-defined order. I have an asmx page providing [WebMethod()]s. Do similar events exist? In particular, some events that allow me to initialize some data (like Page_Load) and do some clean-up (like Page_Unload) would be extremely useful. (As ...

The remote certificate is invalid according to the validation procedure. GMAIL

The function below works in a console application but it's not working in my asp.net web site. I am getting an error: The remote certificate is invalid according to the validation procedure. public static void SendEmail(MailMessage mm) { SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; s...

ASP.net redirect user on condition

Given my registration page: <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server"> <ContentTemplate> <span class="defHead">Thank You!</span><br /><br /> You are now registered on our system.<br /><br /> </ContentTemplate> </asp:...

Image won't display in user control

I have a user control that's got an image ..when I added it to a page that doesn't have a Master Page..the image was getting displayed alright but when I added the same user control to a page with a Master Page.the image vanished!....When I checked the Page source the image's path was there like this.. style = "background-image: url(htt...

Intercepting HTTP in ASP.Net MVC 2

Does anyone have any idea how I can intercept the HTML of a page and stop it getting rendered back to the client? I've tried the following, in a controller method: var writer = new StringWriter(); var response = new HttpResponse(writer); var context = new HttpContext(existingContext.Request, response) { User = existingContext.User }; ...

MVC 2 Model Validation messages

Hi, i have a view model with a property like this one : [RegularExpression(@"^d\+$", ErrorMessageResourceType = typeof(Resources.Validation), ErrorMessageResourceName = "NumberValidationMsg" )] public int? Number {get; set;} NumberValidationMsg resource is set to "Only numbers allowed !". but when I try to enter something like 'test...

Which control to use

Hi! I'm designing a data driven website, the content for which is displayed mostly with Repeater controls. I'm not sure, though, how to present the content that won't be repeated (such as articles). I had thought about using Labels and creating a DataSet when the page loads and populate the Labels on the page with columns from the Data...

How Secure Is Entity Framework?

Just wondering if the entity framework is setup to handle things like SQL injection out the box? Every tutorial I have seen, video, book or blog post. No one mentions security and seems to pass in variables straight into the context with no checks etc... Just wondering what peoples thoughts were on this, and how do you handle this s...

ASP.NET MVC 2.0 - Difference between RenderPartial and RenderAction

I am trying to understand the difference between a RenderPartial and RenderAction. I guess that RenderPartial is like a UserControl and RenderAction is like a server-side include. Can someone put this in perspective please and if possible give me a couple scenarios of where each would be used? ...

Error connecting to Web Service in C#

I am trying to access a web service and calling a method to pass my request parameters. I am programmatically setting my credentials, using: service.Credentials = new NetworkCredential("username", "password", "domain_url"); When in the above code, I pass domain_url, I get this Web Exception, Unable to automatically step into t...

problems with calender extender controller in asp .net

i am using a calender extender control in my asp.net web application. i want to disable this control while clicking on a check box. i used disabled property of calender extender. i set disabled =true . but i have 2 problems. it do not desabling the textbox associated with calender extender control i am using a regular expression val...

How to retrieve XML data using XPath Expression

I have a XMLDataSource somewhat like: <bookstore> <author>author1</author> <publication>publication1</publication> <book> <genre>Thriller</genre> <name>ABC</name> </book> <book> <genre>Romance</genre> <name>XYZ</name> </book> <book> <genre>Horror</genre> <name>000</name> </book> </bookstore> I a...

rich text editor

hi, i want to implement richtext editor in my website. can anyone provide me links to simplest possible editor. ...

Designing a system with a presentation layer and a web service-based API

Hello, We are designing a system that has functionality that is essentially the same at the presentation layer and the exposed API layer. My question is what technique / strategy to use so we can get the most reuse out of our code with performance in mind? Here's a simplified example: A user can add a Customer via a web form. This wil...

ASP.net, retreive domain name /path

I need to fetch the domain name and path from the request to provide the following return values: domain1.com/default.aspx returns domain1.com/default.aspx domain1.com/ returns domain1.com/ domain1.com returns domain1.com At the moment every URL fetch function I try seems to return doma...

Where to place Google Analytics code in ASP.NET web application

I want to find a place to put my Google Analytics code in my ASP.NET web application. I would like to place it somewhere once and not have to copy and paste the code into multiple files. Is there somewhere that I could inject it that I would only have to include it once and all pages would be effected? I am not using MasterPages unfortun...

Build a Menu from the web.sitemap file in ASP.NET

Hello, I have started a new ASP.NET 4 WebForm application. By default, the Site.Master file contains the following menu: <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal"> <Items> <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/> <...

Bugs arised in IE7

I have to retrieve data to the gridview with this query.. string strSelectQuery = "SELECT REPLACE(TITLE, '\n', '<br />') TITLE, REPLACE(DESCRIPTION, '\n', '<br />') DESCRIPTION, " + "ANSWER, FK_OWNER_ID, CREATED_ON FROM M_QA WHERE PK_ID = " + intQuestionId + " AND ...

jquery+jstree in c#.net - webservice responseformat?

I have been playing with jstree (1.0rc2)+jquery (1.4.2) for the first time with c#.net and although I have gotten it working, there are a couple things that I don't understand about how data is provided to the tree by the webservice I use to populate the tree (using ajax and the json_data plug-in). I was hoping someone with more experien...