Aug 26 2008

How to find out what access users have in Windows?

Category: Programmingavinashsing @ 9:22 am

Many times you need to find out what access a particular windows user has and it’s not very easy to get that information. I wanted to get a list of folders/directories to which a particular user (local user in windows) had access to so that i could debug an application. Luckily, i found about a small command line utility tool which enables you to do just that. You will need to download the AccessCheck program and use it to get the access report.

http://technet.microsoft.com/en-gb/sysinternals/bb664922.aspx
http://windowsitpro.com/article/articleid/97672/using-accesschk-to-view-which-files-and-folders-a-user-has-access-to.html


Aug 19 2008

One month car insurance

Category: Automotiveavinashsing @ 5:59 am

I was talking to a friend of mine the other day and he mentioned that he needed to get car insurance for one month only. So I was like “Why can’t you take a normal car insurance policy?” and he told me that a relative of his gave him an old car which they don’t use anymore but could become handy for him. The only problem was that the car was like 12 years old and he was not sure whether it was worth keeping it. So he decided to take 1 month car insurance to try out the car and if he likes it, then he’s going to go for a standard car insurance. This would give me the flexibility of cancelling the insurance if the car was not worth the trouble. Well I hope things work out for him :)


Aug 18 2008

Integrating FCKeditor in my ASP.NET site

Category: Programmingavinashsing @ 5:42 am

So I wanted to try FCKeditor in a website i was redesigning. The first problem i foresaw was that it didn’t have an image resize option. However it seems to be the one closest to meet my requirements, therefore i’m thinking of hacking an image resize utility into the library.

As soon as i copied everything to my project, I got an HTTP Error 404 - Not found. I was like, what the hell just happened there, but then i googled the problem and find the solution. You need to specify the BasePath  (the path where your fckeditor script is located) as follows:

<FCKeditorV2:FCKeditor ID=”FCKeditor1″ runat=”server” BasePath=”~/FCKEditor/” ></FCKeditorV2:FCKeditor>

This gets rid of the error.

However if you want to take advantage of the image uploader, you will need to edit fckeditor.js as follows:

var _FileBrowserLanguage    = ‘aspx’ ;    // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage    = ‘aspx’;

This tells the script to use asp.net as the server side language.

You will also need to modify config.ascx (fckeditor/editor/filemanager/connectors/aspx/config.ascx):

In CheckAuthentication, return true!

In SetConfig(), specify where the files which are uploaded are going to go:

UserFilesPath = “~/userfiles/”;

It is also good to have all images/files/media in separate folders but by default this is not true for quick uploads. So do this for File, Image, Flash and Media:

TypeConfig["File"].QuickUploadPath = “%UserFilesPath%file/”;

TypeConfig["Image"].QuickUploadPath = “%UserFilesPath%image/”;

TypeConfig["Flash"].QuickUploadPath = “%UserFilesPath%flash/”;

TypeConfig["Media"].QuickUploadPath = “%UserFilesPath%media/”;

Remember to give ASP.NET worker process read/write access to the uploaded folder (UserFiles)!


Aug 18 2008

Setting up Visual Studio for improved productivity

Category: Programmingavinashsing @ 5:31 am

Once you install Visual Studio, there are a few things which you need to do so that you are comfortable with the environment and to make your life easier.  Here’s what i like to do:

1. Show line numbers!

2.  Insert attribute value quotes when typing

This can be enabled by
Tools -> Options -> Text Editor -> HTML -> Format
turn on - “Insert attribute value quotes when typing”

3. Change the colours of delegates, Enum etc

More on that later…

4.  If you don’t want IDs of controls to be forced to be unique

Go to Tools -> Options -> Text Editor -> HTML -> Miscellaneous
turn off - “Auto ID elements on paste in source view”


Jul 31 2008

Using Windows Control on an ASP.NET web page

Category: Programmingavinashsing @ 2:14 am

There can be a number of occasions when you would want to use a windows control on your asp.net webpage. For my one, I wanted to bypass the proxy server at work by using the WebBrowser control. The problem was that it was only available to use on Windows Forms and I needed it to work on my asp.net webpage. The idea behind it was that I would be able to browse to my web page which contained the WebBrowser control (as this page would not be banned at work because it will be hosted on a shared hosting server) and all web page requests would be provided by the hosting company rather than directly through the internet connection at work.

I created a Windows Control Library which contained the WebBrowser control and dropped the dll in the root of the website where I would call it from. I made a simple page and within the web form I added the following:

<!– Code Starts Here –>
<OBJECT id=”sert” classid=”http:GisBrowser.dll#GisBrowser.SurfControl” height=”450″ width=”800″ VIEWASTEXT>
<PARAM NAME=”Title” VALUE=”My Title”>
</OBJECT>
<!– Code Ends Here –>

The reason the dll does not go into the bin folder is because it needs to be accessible by the clients (browsers requesting the page) and anything in the bin folder is available to the server only.

Unfortunately the code did not work but this happens only with the WebBrowser control. If you choose any other control, it should work fine. I tried it with a label, treeview and a groupbox and they worked fine.

For references, please see:

http://www.beansoftware.com/ASP.NET-Tutorials/Place-Windows-Control-To-Web-Form.aspx

http://aspnet.4guysfromrolla.com/articles/052604-1.aspx 

On a side note, if you ever wanted to grab the thumbnail of a website dynamically using C#, this link will tell you how to do just that :

http://www.beansoftware.com/ASP.NET-Tutorials/Get-Web-Site-Thumbnail-Image.aspx 


Jul 22 2008

Which ASP.NET process identity for which machine?

Category: Programmingavinashsing @ 8:47 am

By default, ASP.NET does not use impersonation, and your code runs using the ASP.NET application’s process identity. On the Microsoft® Windows Server™ 2003 operating system, ASP.NET applications run in an Internet Information Services (IIS) 6.0 application pool by default. The IIS application pool runs under the NT AUTHORITY\Network Service identity. On the Microsoft Windows® 2000 Server operating system with IIS 5.0 or on Windows Server 2003 with IIS 6.0 configured for IIS 5.0 isolation mode, ASP.NET applications run in a worker process that uses the local ASPNET account identity.

Source: http://msdn.microsoft.com/en-us/library/ms998351.aspx


Jul 22 2008

Location of machine.config file for .net framework

Category: Programmingavinashsing @ 7:10 am

 It might not be obvious where the machine.config file is located for .NET 3.5 Framework, so here’s what Scott Gu said:

The configuration files for applications are versioned using the CLR version, and not the framework library versions.  .NET 3.5 uses the same CLR version as .NET 2.0 - and so share the same root web.config file.  That is why putting the configuration settings there would cause conflicts.

And here’s the locations for the machine.config for the different .NET Frameworks:

For .NET Framework v1.1:

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG

For .NET Framework 2.0:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG

For .NET 3.0 and 3.5:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG


Jul 11 2008

First horse riding lesson

Category: Personalavinashsing @ 1:31 pm

I’ve wanted to learn how to ride horses for a while now and today was my first lesson. For £22 an hour, it was all worth it. I had to pay 50 pence to hire a hat as well. I went to King’s Oak horse riding school and although the people training us beginners were quite young, let me rephrase that actually, kids (most of them), they were really good and know what they were doing. I really enjoyed myself and thinking of taking it up as a hobby now :)


Jun 25 2008

How to consume an ASP.NET webpage in JavaScript?

Category: Programmingavinashsing @ 9:05 am

Ever wondered how you can use your .net page to render output in javascript, something similar to Google Ads (Adsense)? What you want to do is have an ASP.NET page which does a bit of logic coded in C#VB.NET which other people can consume on their websites through a simple javascript call to your asp.net page. The solution is really easy - all you have to do is create your webpage as normal and stick your business logic inside it and then for the things your want to output, you use:

// BusinessLogicPage.aspx

string message = “This is the output from my ASP.NET page!”;

Response.Write(”document.write(’” + message + “‘);”;

Response.End();

// ConsumerPage.html (it can be anything because we are going to consume it in javascript

<script src=”BusinessLogicPage.aspx” type=”text/javascript”></script>

Where you place the script tag, you will get the output from your BusinessLogicPage just like when you place Adsense codes on your pages, Google delivers ads to these pages.


Jun 25 2008

Problem with IFrame in a table

Category: Programmingavinashsing @ 5:02 am

You must be wondering why would someone need an iframe within a table, right? Well, i had to consume an rss feeds within a Classic ASP application and the VB6 codes were not doing the job because the MSXML parser found errors in the XML document. Doing it in C# (asp.net) had no problems at all and because i had already waster more than 1 day trying all the different solutions i’ve googled, i thought it would be best to load the rss feeds in an iframe within the classic asp codes as you cannot import aspx pages in a classic asp page. To add to the fun, the iframe would need to sit within a table and the moment i tried sticking the iframe in, all the other data in the table data (td) dissappeared. The solution was really simple, the browser (internet explorer) did not like the self-closing tag, so you need to explicitly have a closing tag.

<iframe src=”bla.aspx” frameborder=”no” /> (did not work)

<iframe src=”bla.aspx” frameborder=”no”></iframe> (works like a charm)

There you go! Saved for future reference :)


« Previous PageNext Page »