To encrypt the appSettings section of web.config
aspnet_regiis -pe "appSettings" -site "YourWebsite" -app "/"
and to decrypt
aspnet_regiis -pd "appSettings" -site "YourWebsite" -app "/"
You can encrypt any portion of the web.config file.
Simple
Tuesday, November 28, 2006
Tag Cloud
Scott Mitchell has an article over on the 4GuysFromRolla site about creating a tag cloud, I have seen these on several sites such as weblogs.asp.net. I never new they where called tag clouds so that is something I have leant already.
Saturday, May 20, 2006
Changing default browser in VS 2005
If you want to change the default browser when developing web applications with Visual Studio 2005, then simply right click the website in Solution Explorer and choose the Browse with... option. Choose what browser you want, if it isn't listed there click on the Add button and browse for the .exe. You can then set this new browser as the default.
Thats it for now tara.
Thats it for now tara.
Sunday, April 23, 2006
Problem with Master Pages in ASP.Net 2.0
I have come accross a major problem in master pages in the new asp.net 2.0. Here is a section of my code.
Dim myMaster As MasterPage = Page.Master
Dim myControl As Control = myMaster.FindControl("ReportMenu")
Dim myControlType As Type = myControl.GetType
Dim mtype As Type = myControl.GetType
Dim minfo As MethodInfo = mtype.GetMethod("Populate")
Dim myparamarray() As Object = {myArray}
minfo.Invoke(myControl, myparamarray)
This code simply locates a control in my web page. This page happens to belong to a master page, so while searching for the control it has to move down through the structure - Master - Page - Control. When the control 'ReportMenu' is located, it uses reflection to invoke the Populate method in that control. Working in the VS 2005 environment this all works fine. However moving over to a pre-deployment server this error occurs.
Unable to cast object of type 'ASP.masterreporting_master' to type 'MasterPage'.
The culprit line is.
Dim myMaster As MasterPage = Page.Master
After a quick search online I came accross this link.
http://visualbasic.ittoolbox.com/blogs/featuredentry.asp?i=7878
The web.config file has an element
<compilation debug="true" strict="false" explicit="true">
By default, batch compilation is set to true, so add the attribute batch="false" to this element. There is apparently a fix for this issue according to Scott Guthrie in the post mentioned above.
Dim myMaster As MasterPage = Page.Master
Dim myControl As Control = myMaster.FindControl("ReportMenu")
Dim myControlType As Type = myControl.GetType
Dim mtype As Type = myControl.GetType
Dim minfo As MethodInfo = mtype.GetMethod("Populate")
Dim myparamarray() As Object = {myArray}
minfo.Invoke(myControl, myparamarray)
This code simply locates a control in my web page. This page happens to belong to a master page, so while searching for the control it has to move down through the structure - Master - Page - Control. When the control 'ReportMenu' is located, it uses reflection to invoke the Populate method in that control. Working in the VS 2005 environment this all works fine. However moving over to a pre-deployment server this error occurs.
Unable to cast object of type 'ASP.masterreporting_master' to type 'MasterPage'.
The culprit line is.
Dim myMaster As MasterPage = Page.Master
After a quick search online I came accross this link.
http://visualbasic.ittoolbox.com/blogs/featuredentry.asp?i=7878
The web.config file has an element
<compilation debug="true" strict="false" explicit="true">
By default, batch compilation is set to true, so add the attribute batch="false" to this element. There is apparently a fix for this issue according to Scott Guthrie in the post mentioned above.
Thursday, February 23, 2006
Great new job
Well I am settling in to my new job. Where I now work they have an MSDN subscription, so I have got access to lots of new MS goodies.
My main job is software development using vb.net, accessing a number of back end SQL Servers. I have just finished a project that ties in to an in house system and transfers data to and from GPRS handhelds. Pretty cool stuff. I have used and re-used lots of the same code I wrote in my previous position, some of it I have posted on thedotnetdiary. There is so much I need to update on that site. When I do I will blog about it here.
My main job is software development using vb.net, accessing a number of back end SQL Servers. I have just finished a project that ties in to an in house system and transfers data to and from GPRS handhelds. Pretty cool stuff. I have used and re-used lots of the same code I wrote in my previous position, some of it I have posted on thedotnetdiary. There is so much I need to update on that site. When I do I will blog about it here.
Monday, November 21, 2005
DateFormat amongst other things
I have uploaded a simple DateFormat control to thedotnetdiary website. All it really does is makes dates look nicer. For example if you have a date such as 01 September 2001, then it will format it as 1st September 2001. Simple as that. It is something I implement on a few projects I have been involved with and have finally written the control. The zip file can be found here. To implement it using c#, do the following.
using DNDDateFormat;
///
/// the rest of your aspx page code
///
DNDDateFormat.FormatDate myDate2 = new DNDDateFormat.FormatDate();
Response.Write(myDate2.SortDate(DateTime.Now));
.
.
.
Its as simple as that.
I have now secured a new job doing more vb.net and SQL development over web development (although that will be a project in itself at some point). So I am now spending most of my time documenting my systems so somebody else can come in and maintain them. Once I settle in to my new job, I will post more details of what I am getting up to.
I have been looking in to the new VS2005, so far I am very impressed, I especially like the code snippets utility and will definetly be using that to a great extent.
using DNDDateFormat;
///
/// the rest of your aspx page code
///
DNDDateFormat.FormatDate myDate2 = new DNDDateFormat.FormatDate();
Response.Write(myDate2.SortDate(DateTime.Now));
.
.
.
Its as simple as that.
I have now secured a new job doing more vb.net and SQL development over web development (although that will be a project in itself at some point). So I am now spending most of my time documenting my systems so somebody else can come in and maintain them. Once I settle in to my new job, I will post more details of what I am getting up to.
I have been looking in to the new VS2005, so far I am very impressed, I especially like the code snippets utility and will definetly be using that to a great extent.
Wednesday, October 12, 2005
File upload max size
Have you ever developed a file upload tool? Well if you have, you will proberbly come accross a limit in the size of file you can upload. This limit can be configured in two places, the machine.config or web.config.
In machine.config, change the maxRequestLength attribute of the <httpRuntime> section. By default it is around 4Meg. The value is in kilobytes.
Alternativly if you have an admin section and you want a different limit to upload for admins, change the web.config file within the admin directory (you do have an admin directory don't you?)
Again it is the maxRequestLength attribute of <httpRuntime> and needs to be within the <system.web> section.
I hope this helps someone.
In machine.config, change the maxRequestLength attribute of the <httpRuntime> section. By default it is around 4Meg. The value is in kilobytes.
Alternativly if you have an admin section and you want a different limit to upload for admins, change the web.config file within the admin directory (you do have an admin directory don't you?)
Again it is the maxRequestLength attribute of <httpRuntime> and needs to be within the <system.web> section.
I hope this helps someone.
Thursday, August 04, 2005
Editing HTML on a .net web page
Recently I have been working on a project that requires editing of HTML through a content management system. Initially I used a component call EasyWebEdit, but as more and more people are switching to Firefox I needed a component that supported it. I chose a component called FCKEditor. I have just published an article on The DotNetDiary quickly explaining what you need to do to get it up and running.
I am also working on a couple of other articles for my site, so stick arround there may be something of interest to you.
I am also working on a couple of other articles for my site, so stick arround there may be something of interest to you.
Wednesday, May 11, 2005
Workgroup Diary Application...cool!!!
I have been working on a cool app just recently. Basically it reads information from Outlook, calls a webservice on our server and dumps the data in to the SQL Server back end. Then there is a calendar application which then displays the details in a neat fasion. It is the first real experiment I have done with web services and to be honest I am very pleased with it. I am still at the testing phase, but will hopefully post some code here soon. The calendar web application uses a cool control developed by Mike Ellison and can be found over at Code Project.
Still working on my DotNetDiary site, and to be honest, I am finding it difficult to find the time to do it. I am going to look in to those Microsoft starter kits to see if they are any help. I will report back any findings.
One of the projects I will be working on soon is a Virtual Learning Environment which runs on asp.net. I am not intending to build one from scratch, but perhaps implement a third party tool. Hmmm!
I am also working arround a problem I have with the CMS for my site at work. It uses a cool component called EasyWebEdit. However as I am now using Firefox as my browser, it doesn't render correctly. I cannot use IE as for some reason no matter what I do I cannot get it to access the Internet. Anyway to cut a long story short, I will be looking in to word processor type web editors and compare them to a bespoke version.
I am off on my Jollies next week, so I will not be blogging for a while. Not that I regularly do anyway.
Still working on my DotNetDiary site, and to be honest, I am finding it difficult to find the time to do it. I am going to look in to those Microsoft starter kits to see if they are any help. I will report back any findings.
One of the projects I will be working on soon is a Virtual Learning Environment which runs on asp.net. I am not intending to build one from scratch, but perhaps implement a third party tool. Hmmm!
I am also working arround a problem I have with the CMS for my site at work. It uses a cool component called EasyWebEdit. However as I am now using Firefox as my browser, it doesn't render correctly. I cannot use IE as for some reason no matter what I do I cannot get it to access the Internet. Anyway to cut a long story short, I will be looking in to word processor type web editors and compare them to a bespoke version.
I am off on my Jollies next week, so I will not be blogging for a while. Not that I regularly do anyway.
Wednesday, March 02, 2005
Slowwwwww website
Firstly I would like to say congrats to the DotNet Rocks team on reaching their 100th show. Yeah I know I was a couple of weeks ago, but I have only just got arround to listening to it. Very funny clips from various .net people such as Don Box, Dino Esposito and others.
Have you ever had a web site up and running only to have it be slow on the first request??? Well as you probably know, first request can be slower due to the .net compiler doing its' job. I run a site which seems to have a slow response after a while from the first visit. I don't know the complexities of the processes going on, but I have tried cacheing. Well anyway I have written this small console app which gets called every now and then from the standard Windows Scheduler. It simply reads a text file storing URLs' and requests them.
This is the code.
For this to work, you need a file called URLFile.txt in the same directory to read from.
Sorry for the lack of comments, bad habit I know. Well basically it reads each line from URLFile.txt does a web request using WebRequest.Create() and if it gets a response, writes it out to the console. The Try...Catch section handles any exceptions such as bad URL's.
You can compile this using the vbc like this:-
vbc /t:library /r:System.dll WebRequestAuto.exe
When I finally get my web site up and running, I will probs repost this code with the resulting .exe (with comments perhaps)
Have you ever had a web site up and running only to have it be slow on the first request??? Well as you probably know, first request can be slower due to the .net compiler doing its' job. I run a site which seems to have a slow response after a while from the first visit. I don't know the complexities of the processes going on, but I have tried cacheing. Well anyway I have written this small console app which gets called every now and then from the standard Windows Scheduler. It simply reads a text file storing URLs' and requests them.
This is the code.
Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Module Module1
Sub Main()
Dim objReaderToCount As New StreamReader("URLFile.txt")
Dim objReader As New StreamReader("URLFile.txt")
Dim p As Integer
Dim strCount As String
p = 0
While objReaderToCount.Peek() > -1
strCount = objReaderToCount.ReadLine
p = p + 1
End While
objReaderToCount.Close()
Dim arrURL(p) As String
Dim I As Integer
Dim strReadLine As String
While objReader.Peek() > -1
For I = 1 To p
strReadLine = objReader.ReadLine
Console.WriteLine(strReadLine)
arrURL(I) = strReadLine
Next
End While
objReader.Close()
Dim intI As Integer
For intI = 1 To p
Dim Request(intI) As HttpWebRequest
Try
Request(intI) = WebRequest.Create(arrURL(intI))
Dim Response(intI) As HttpWebResponse
Response(intI) = Request(intI).GetResponse()
Dim resStream(intI) As Stream
resStream(intI) = Response(intI).GetResponseStream()
Console.WriteLine("Web Request..." + arrURL(intI))
Catch ex As Exception
Console.WriteLine("An error occurred:")
End Try
Next intI
End Sub
End Module
For this to work, you need a file called URLFile.txt in the same directory to read from.
Sorry for the lack of comments, bad habit I know. Well basically it reads each line from URLFile.txt does a web request using WebRequest.Create() and if it gets a response, writes it out to the console. The Try...Catch section handles any exceptions such as bad URL's.
You can compile this using the vbc like this:-
vbc /t:library /r:System.dll WebRequestAuto.exe
When I finally get my web site up and running, I will probs repost this code with the resulting .exe (with comments perhaps)
Friday, February 18, 2005
Where we are heading!!!
There is a good article at ITArchitect describing the next stages on the .net journey. Find it here at http://www.itarchitect.co.uk/articles/display.asp?id=108. The final outcome (???) is Windows Longhorn via .net V2.0, Avalon, Indigo and of course Whidbey (does anybody at ms get payed to think these names up?). Must admit, can't wait to get my grubby hands on VS 2005. I have been playing arround with Visual Web Dev 2005 Express, it's pretty cool, but at the moment I am of course only using 1.1 in deployment projects.
On another front, I have been using Gemini bug tracking tool to keep track of all those pesky little blighters that can hamper development. Since installing it, I have already started decreasing my bug-list. It can be downloaded from http://www.countersoft.com. For a one person liscence, it is free, yahoooo!!!
On another front, I have been using Gemini bug tracking tool to keep track of all those pesky little blighters that can hamper development. Since installing it, I have already started decreasing my bug-list. It can be downloaded from http://www.countersoft.com. For a one person liscence, it is free, yahoooo!!!
Wednesday, February 09, 2005
Phew another mini project complete
I have just finished work on another website for a conference we are organising. It's only a small site, but sometimes even the smallest sites can eat up your time. I am hoping to get cracking on writing the new dotnetdiary site like right now. I have all the tutorials from the pre-hacked site, so at least I have something to build on. I have a couple of downloads to add aswell which some of you may be interested in.
So MS have launched a new search tool. I tried it the other day by putting my name in and seeing what was out there, well it turned up an online course in Astrophysics which I created some years ago for my BSc.
I am currently doing a Masters in Computing and was thinking of researching search methods for the web. Early days, but I am starting to gather info already.
So MS have launched a new search tool. I tried it the other day by putting my name in and seeing what was out there, well it turned up an online course in Astrophysics which I created some years ago for my BSc.
I am currently doing a Masters in Computing and was thinking of researching search methods for the web. Early days, but I am starting to gather info already.
Tuesday, January 18, 2005
I know, I know...
Yes it has been a while since my last blog, but you know what its like. Working on a lot of things both in work and out at the moment. It's not long since I moved house, so I am busy working on that getting it up to scratch. I have had to postpone development on the dotnetdiary site for a while. In work I am still working on adding metadata to resources stored in SQL Server. It is a bit of a nightmare because I have to extract resources from many places add the meta data using RDNLTSN Application Profile and then combine the data in to SQL Server. I then have to pump out OAI compliant XML to the web. I am also writing a piece on MathML for one of our publications, so I am busy researching that, as well as attending college ( I am finally doing a Masters in Computing). Oh what else, oh yeah a couple of book reviews. And eating, drinking and basically having a life.
Sorry for going on so much. I realised I haven't exactly explained what it is I do. Basically I am an Astrophysicist working as a web developer/programmer for a University physical sciences department whose main technologies are .Net. I get involved with asp.net, vb.net, SQL Server, Windows 2003 Server, XML and some other technologies.
The site can be accessed here:- www.physsci.heacademy.ac.uk
Sorry for going on so much. I realised I haven't exactly explained what it is I do. Basically I am an Astrophysicist working as a web developer/programmer for a University physical sciences department whose main technologies are .Net. I get involved with asp.net, vb.net, SQL Server, Windows 2003 Server, XML and some other technologies.
The site can be accessed here:- www.physsci.heacademy.ac.uk
Thursday, December 09, 2004
Visual Studio Web Developer
Just a quick one here. As I am re-writing thedotnetdiary.co.uk I have opted to use the beta of Visual Web Developer 2005 Express Edition. My first impression has to be a big thumbs up. MS have judged the area spot on. It lays somewhere between Web Matrix and the full Visual Studio. It uses .net v2.0, so you have to make sure that you do not use anything 1.1 cannot handle when going in to production. One thing I realy like is you have a choice if you wish to use code-behind or not. The Toolbox sweeps in and out like VS and you can pin it down. That is one area I thought Web Matrix lost out on. Oh and there is Intellisense and autocomplete. Go take a look. The URL for more info is http://lab.msdn.microsoft.com/express/.
Tuesday, November 30, 2004
Lycos/Codezone
Two things to report today. Firstly congrats to Lycos for releasing their anti-spam screeansaver. If you don't know anything about it go here for a look. It's about time someone tried taking on the spammers.
Secondly, I just stumbled across a UK project called Codezone. It's a MS backed project, don't know too much about it, but it lists different resources about .net and is UK based (albeit based on a US project). Go take a look. I will certainly be posting some stuff there. Doug Seven heads the US version, so it has a dotnetJunkie at its helm which has to be good news.
Secondly, I just stumbled across a UK project called Codezone. It's a MS backed project, don't know too much about it, but it lists different resources about .net and is UK based (albeit based on a US project). Go take a look. I will certainly be posting some stuff there. Doug Seven heads the US version, so it has a dotnetJunkie at its helm which has to be good news.
Friday, November 26, 2004
Events
As I am researching content for www.thedotnetdiary.co.uk I have come across Devweek 2005 which is on the 21st-25 Feb 2005. I would love to go to something like that, but with a price tag of arround £1000 there is no chance I could get my dept to fund it. I know MS do small regional events that are either free or very minimal cost, does anyone know of any .net events that are free. If you know of any let me know here administrator@thedotnetdiary.co.uk .
Go Blogger Go
Well after sutch a long time pondering over blogging, I have finally set one up. My website www.thedotnetdiary.co.uk which was where I used to put my blogg messages was hacked last month, so as I am rewriting that, I may as well sepperate the blogging stuff and my other .net stuff.
Thedotnetdiary will be back soon. I am currently restructuring it with Visual Studio, more on that soon.
Thedotnetdiary will be back soon. I am currently restructuring it with Visual Studio, more on that soon.
Subscribe to:
Posts (Atom)