ASPCode.net
Free asp.net and asp scripts
Home
ASP.NET articles
.NET
Applications
ASP
Other
ASPCode.net Blog
ASP.NET auctions
Navigation:
Start
Subcategories
»
ASP.NET articles
»
.NET
»
Applications
»
ASP
»
Other
Popular searches
Search...
asp
free asp script
admentor
admentor pro
free asp scripts
free asp.net script
asp.net
asp developer
jquery
Searching for how to gine username and password in URL dirrectly
CreateUserWizard using email as username
A very common scenario is to use email address as login id instead of a username. Here I will show you my approach to that CreateUserWizard tweaking: The idea was first to somehow hide the username field, and in the event CreateUserWizard1_CreatingUser set the UserName to the Email. Well, that di...
Send mail with username and password against other email server
This little snippet is what I use when I send emails from my ASP.NET applications. While the default SMTP server is closed on my box I need to authenticate against the mail server and the code for that is nothing you remember from time to time - so here it is: public static void Se...
C# code to post to Livejournal
While Xmlrpc in theory is a really nice feature, in practice it's really hard to work with. Never considered myself as a XML type of guy and now we're adding a whole new level of rpc urls, authentication etc. I bet there might be some nice library out there, but when I need to get somethiung d...
MySQL backup,compress and FTP from WinForms app
What is this? From your Windows Forms application, implement two menu commands a) backup entire MySQL database, compress it and send it with FTP to a ftp server b) reverse = fetch from FTP server, uncompress, restore to MySQL Kind of open/save functionality for my database app. Why? A way f...
Send mail from ASP.NET using your gmail account
In this article we created a generic ASP.NET SendMail function - which I thought should fit most scenarios. I.e authentication/no authentication, localhost/remote host etc. However, one thing the function can't do is SSL authentication . Lets add that: public static void SendMail(st...
Changing password without entering old password
Another thing bothering me is the need (for an already logged in user) to enter the old password when changing to a new password. Same sort of solution as for using email as username - i.e we need to hide the CurrentPassword textbox control (by specifying a template). ...
Storing passwords in your ASP.NET application - part 1
This guide will show you how to store your user passwords in an ASP.NET - or Windows Forms - application. Or rather - it will show you the secret is to NOT store the actual password. I'll explain later, don't worry. There is always a risk of someone getting their hands of sensitive...
A simple login mechanism instead of built-in Forms Authentication
While ASP.NET certainly do give us developers a pretty nice security/login model sometimes I feel a little frustrated when wanting to implement it. I mean in theory it's as simple as: 1. Define a few lines in web.config 2. Create a login.aspx page But at least for me, I seem to never be able to ...
Built-in Forms Authentication - against a database
This is an enhancement of these article(s) Built-in Forms Authentication - description Built-in Forms Authentication - sample with DOWNLOAD Lets enhance the solutions from those articles by not storing the users and passwords in web.config but instead in a database. Database table ...
Generating a random password
This function can be used to have a random password generated. It allows you to specify valid characters as well as specifying number of characters. <% Function Password_GenPass ( nNoChars , sValidChars ) ' nNoChars = length of generated password ' sValidChars = v...
Update email username with verification
When using email adresses as username and requiring verification by email as we have shown in earlier articles, there is one thing still we need to implement. The user must be able to change their username (i.e email address) and we need to implement some verification scheme for that as well...
Web.config and membership
Lets look at what your web.config looks like with regards to membership, role and profile system. If you want to use SQL 2000 as database backend, then you need to enter these entries by hand. First under system.web you define providers for erach of the subsystems - i.e a membership provide...
Implementing MySQL DAL - howto part 13
Please read this article serie from the beginning First step is of course to create a MySQL database - with the same columns as the MSSQL. I used a database called DemoUpload and ran this script DROP TABLE IF EXISTS `demoupload`.`cust_file`; CREATE TABL...
Built-in Forms Authentication - description
As you for sure already now ASP.NET gives us developers a pretty comprehensive security and login model, and when looking at a complete solution it's pretty easy to understand and use. However I think the model is not all that intuitive, maybe I'm getting old or just stupid, but I never seems to r...
Securing pages with login scripts
These functions can be used on certain pages you want password protected. First create a file called includelogin.asp with this content: <% Response . Buffer = True Function ValidateLogin ( sId , sPwd ) ' For you to validate ID and PASSWORD ' M...
Built-in Forms Authentication - sample with DOWNLOAD
We want to implement a login solution to all files in directory /admin/. All other pages should be public. Lets look at the filestructure in Visual Studio: The webroot default.aspx page looks like this: As you can see we can surf to that page with no trouble. When trying to access /admin...
Creating a demo version of your ASP.NET application
Setting up a live demo on your website is often important for your business - people want to see how the application looks and get a feeling of it and not all people are willing to download a trial version and go through a (painful?) install process just to get the first look. Howev...
Creating an ASHX handler in ASP.NET
Today a typical web application is not only about serving HTML to browsers, but also serving XML and other types of content. Say you are creating a RSS feed for your site, for example. RSS should be presented as XML and I will cover that specific case in another article (will be available in rela...
Requiring email verification for new accounts
One thing that's really common is to require email verification before letting a new user into the system. The CreateUserWizard by default doesn't work that way, basically after user registration is done you are logged in automatically (if LoginCreatedUser=true) or if false then the user just...
Changing loginname and password
This is also done with modifying the web.config file: <authentication mode="Forms"> <forms name="mylogin" loginUrl="admin/login.aspx"> <credentials passwordFormat="...
Storing passwords in your ASP.NET application - part 2
In part 1 you got the background - lets look at the sample code. It's a Windows Forms application and shows you the different types of storing solutions discussed. It uses a SQL Server database - and to create the tables the script is available from within the app: ...
Process.Start and redirect standard output
This snippet will show you how to start a command line program - and redirect the output from it to a System.IO.StreamReader. You can then easily read all the output generated from the external program and analyze it or do whatever you please with it: The example below calls th...
C# and Lucene to index and search
This sample will show you how to use Lucene from your .NET application to index and search content. There are some articles and samples to be found on the web, but it seems that they are a bit outdated. Myself I used Lucene version 1.4 something some year(s) ago and thought now that I needed it a...
Using ASP scripts from HTM pages
1. What does he mean? Well I guess that's what you must be asking yourself - and I really have to agree the title looks kind of cryptic. I understand I'd better motivate you to keep reading, so I do my best: Imagine you have this site and you have a Latest news-function where news headlines are ...
CreateUserWizard basics
Now we have created our database, fixed our web.config - now it's time to test to see if it works... Just drag a CreateUserWizard control onto your webform: As you can see the security question/answer stuff is there - even though we earlier have specified in our web.config it should ...
Connectionstrings in ASP.NET 2.0
By email I was asked about <connectionstrings> in web.config and if it was justified to not use it in certain specific scenarios. While "being used to appSettings" is not enough to me, there could indeed be more complex scenarios and therefore a lot more to it th...
Accessible Ajax calls
Say a paging scenario. You have a repeater and shows the pages one by one and also you have some sort of "pager". Personally I never use the built in paging mechanism for say the gridviews - simple because it needs a postback. Which means the pages after the first one&...
New version 2006-02-03
A new version is available for download. This version forces login to access the admin pages. Seriously I have no idea how I was thinking six years ago when I didn't add this functionality - cause I do have it in all my other scripts. Anyway, now it's added and as usual the file to look in is in...
Creating a BLL - howto part 6
Our project so far might indeed be functional, but we do have some major design flaws to fix. It is not so good to do all our database work directly from our ASPX files - and since we will eventually need to support MySQL as well as MSSQL, that would be a nightmare to fix if we had to cha...
Dynamically loading dll in .net - howto part 11
Please read this article serie from the beginning In part 10 we started implementing our DAL - and having it implement a welldefined interface is gonna make our application able to dynamically load which data access layer to use. It will open up for the possiblity ...
Use in your own site
Well, the meaning of PollMentor is of course for you to be able to use it on your own sites, so here's a breif descriptions on how to do it: Depending on whether you are using some templating engine or not it will be slightly different, but the main things for you is to do some includes ...
Creating a Windows service in C#
Our goals: Create a service, which will be installed in Service Manager as any service It should however (pretty much like the MySQL service) be able to run it from commandline (use a -cl switch). So, in Visual Studio, we should be able to run it in debug mode just like any co...
Creating an RSS feed for your ASP.NET site
How useful a RSS feed actually is is hard for me to say something about, I personally have a hard time understanding the buzz about blogs (why should that be better than a regular website). While the content people present in blogs might be really good - I just love Scott Guthries blog...
Deleting files, checkboxes in repeater - howto part 5
It is highly recommended you start this tutorial article serie from the beginning . In this part we will continue our work with the upload and file management. In part 4 we created Edit customer form with three upload controls - but also we have a repeater section showing all exis...
Binary data in database - howto part 4
We will now continue to work on your "customer" editing application we started in Part 1 - so please read it and Part 2 as well. In Part 3 we stored the data in SQL Server. Now it's time to get the data out of there as well. This is how the GUI looks when ed...
Master pages in ASP - free template engine
We are here gonna create a three page website - all pages should use a "template" for layout. This will enable us to easily keep a consistent layout for all our pages and also, it sure brings structure to your code. I have used this technique for 5 years or so, one lar...
ASP.NET and JQuery - updating templated controls with AJAH
Continuing our serie on JQuery and ASP.NET we are now gonna create an interface looking like this: When selecting a filter we want to spawn an Ajax request and update only the table part of the interface: So far we have used ASHX handlers and returned JSON structures cont...
Ajax and dynamic html tooltips - part 1
Tooltips are not only cool - they also fill an important purpose by being able to keep information hidden until the visitor (typically by moving the mouse over a certain item) want more information. There are a lot of libraries out there implementing tooltips by Javascript ( als...
Url rewriting - Cannot use a leading to exit above the top directory
I am using Google sitemaps to see that my sites are getting indexed without trouble. And - believe me or not - after creating a new site and creating the sitemap (article on that will follow) - I saw that google could only read the index page - not the pages below. After lo...
BLL next step - howto part 7
Now, in this part of the " In practice " serie - lets look more into our movement from ASPX pages directly consuming datasets and datatables into using classes in a sort of business layer. While the code for the customer was pretty straigtforward, we do get some interesting pro...
Repeater control and separator
This is kind of a twist of the article Insert user control every N records in gridview . I am gonna show you (and give you the C# code) for a ASP.NET 2.0 repeater control giving you some flexibility with regards to repeater items. This technique is totally different, in the previous arti...
Interfaces and generic collections in C#
When developing ASPCodeHeaderManager I created a servercontrol for managing javascripts etc in an ASP.NET page. Later I needed a specific servercontrol to be able to interact with the ASPCodeHeaderManager control. However - I wanted to keep the two controls totally unk...
Coding the grouping repeater
This is part 5 of this tutorial on how to create a expandable/collapsible grouping repeater control with ASP.NET. So, please start by reading part 1 . Now lets move on to the ASP.NET code. The repeater control ASPX tags looks like this:
Logging in to admin part
Browse to http://localhost/PicMentor/admin/ (or whereever you have installed the product) and you are asked to login. You login with the username and password as specified in the web.config file ...
Your own configuration setting section in web.config
I have often talked warmly for using appSettings instead of creating your own custom section in web.config - however I do admit there are some pretty nice things with them. First and maybe most importantly - in a world of component reuse - it is a good way of avoiding name co...
Convert string to datetime
This is a favorite function I used a lot when getting data from remote systems. For example I once needed to retrieve data from an AS/400 box, and the file format was already specified. However, date fields in the file could look pretty different (6, 8, 10 digits with or without delimiters between...
Using thumbshots.org in ASP.NET and C# - part 2
Please start reading this from the beginning Part 2 - we continue our development of the thumbshots.org cache handler: Our img src will point to: img src="thumbshot.ashx?u=www.yoursite.com" and lets start with looking at the handler code: public void Proce...
Interface to Data Access Layer - howto part 10
Please read this article serie from the beginning In this step - lets look back on the project so far. Remember our save button click event handler in editcust.aspx? if (Page.IsValid) { int lId = -1; if (Request["id"] != null) ...
JQuery tree viewer in ASP.NET
Here's a ASP.NET and JQuery based tree viewer example. I'm using Jörn Zaefferers treeview for the javascript tree rendering for the simple reason it's completely unobtrousive. You mark the tree up by regular ul/li structure - meaning if someone doesn't have Javascript activated (say a search en...
ASP.NET, MySQL and paging
In this article we will create a simple one page ASP.NET web application, implementing paging using the cool MySQL feature LIMIT and SQL_CALC_FOUND_ROWS. One of the coolest things about MySQL is some of its non standard features. It might sound like a weird thing to say, but being a web develo...
Searching for
how to gine username and password in URL dirrectly