Thursday, December 20, 2007

Hide your website source code. PreCompile your site before deploy.

Suppose you want to deploy asp.Net website without deploying any source code to webserver. This can be achieve in the following way.

Aspnet_compiler.exe (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ Aspnet_compiler.exe) can help you to achieve this goal.

Step 1.

Run following command in command prompt of the webserver:

Aspnet_compiler -p "D:\MyWEbSite" -v / c:\OnlyAssembly

Here,

D:\MyWEbSite is the path where my website source code resides

c:\OnlyAssembly is the path where assembly dlls will be generate


 

Step 2

The command will generate the required .dlls and .config files under the folder c:\OnlyAssembly.

Step 3.

Create a virtual directory in IIS and map this directory with that virtual directory.

Step 4.

Your application is deployed on the server without any source code to be deployed on the server. Open the website and browse it ahead!!!


 

NOTEs:

  1. If you open an ASPX file in a pre-compiled target directory you'll see the following content: "This is a marker file generated by the precompilation tool, and should not be deleted!"


     

  2. For some people, the ability to update content on the web server by modifying aspx and ascx files is a needed feature. To support this scenario, the aspnet_compiler has the –u switch for an "updateable" pre-compilation. With updateable pre-compilation the ASPX, ASCX, ASHX, and MASTER files are copied to the target directory in tact - they do not become 'marker' files. You can deploy these files to the server and modify them without causing an error, because the ASP.NET runtime will dynamically parse and compile these files. All of the source code for code-behind files and in the App_Code folder will still be compiled into assemblies and will not need to be deployed.


     

  3. A benefit to pre-compilation for deployment is that no one can make changes to the web application by tweaking the source code – no source code exists!


     

Please revert back if any queries.


 

Thanking You,

Indrajeet Kumpavat.

indrajitk@gmail.com


 

Saturday, November 24, 2007

Connection Pooling via connection string

Connection Pooling via connection string.--

    ConnectiOnLifeTime - time in seconds AFter which the connection will be destroyed.

    MaxPoolSize - Max connection in pool

    MinPoolSize - Minimum number of inactive of connection will remain in pool.

    Pooling=True


 

Samples connection string is :

SqlConnection con = new SqlConnection();
con.ConnectionString = "Data source=DataServer;" +
  "Integrated Security=true;Initial Catalog=Sales;" +
  "Pooling=true; Max Pool Size=200; Min Pool Size=1;"+
  "Connection Lifetime=0";
con.Open();

Thursday, October 4, 2007

JavaScript : Attach event handler to control at runtime

Here is the sample.


 


 


 

var RadioButton1 = document.getElementById(LogoSettingId).children[0].children[0].children[0].children[0];


 


if (RadioButton1.addEventListener)

{


// Non-IE browsers

RadioButton1.addEventListener('onclick', RadioButton1_click, false);        

}


else
if (RadioButton1.attachEvent)

{


// IE 6+

RadioButton1.attachEvent('onclick', RadioButton1_click);

}


else

{


// Older browsers


var currentEventHandler = RadioButton1['onclick'];


if (currentEventHandler == null)

{

RadioButton1['onclick'] = RadioButton1_click;

}


else

{

RadioButton1['onclick'] = function(e)

{

currentEventHandler(e); RadioButton1(e);

}

}

}

Tuesday, September 25, 2007

The woman in your life … Very well expressed

Tomorrow you may get a working woman, but you should marry with these facts as well.
Here is a girl, who is as much educated as you are;

Who is earning almost as much as you do;

One, who has dreams and aspirations just as you have because she is as human as you are;

One, who has never entered the kitchen in her life just like you or your sister haven't,as she was busy in studies and competing in a system that gives no special concession to girls for their culinary achievements ;

One, who has lived and loved her parents & brothers & sisters, almost as
much as you do for 20-25 years of her life ;

One, who has bravely agreed to leave behind all that, her home, people who love her, to adopt your home, your family, your ways and even your family name;

One, who is somehow expected to be a master-chef from day #1, while you
sleep oblivious to her predicament in her new circumstances, environment and that kitchen ;

One, who is expected to make the tea, first thing in the morning and cook food at the end of the day, even if she is as tired as you are, maybe more, and yet never ever expected to complain;
to be a servant, a cook, a mother, a wife, even if she doesn't want to;
and is learning just like you are as to what you want from her;
and is clumsy and sloppy at times and knows that you won't like it if she is too demanding,
or if she learns faster than you;

One, who has her own set of friends, and that includes boys and even men at her workplace too, those,who she knows from school days and yet is willing to put all that on the back-burners to avoid your irrational jealousy, unnecessary competition and your inherent insecurities;

Yes, she can drink and dance just as well as you can, but won't,simply because you won't like it, even though you say otherwise ;

One, who can be late from work once in a while when deadlines, just like yours, are to be met;

One, who is doing her level best and wants to make this most important relationship in her entire life a grand success, if you just help her some and trust her;

One, who just wants one thing from you, as you are the only one she knows in your entire house - your unstinted support, your sensitivities and most importantly - your understanding, or love, if you may call it.

But not many guys understand this…

Monday, September 17, 2007

How to change title of the task form in SharePoint2007

To make the title name custom,

Copy and paste the following code before starting of the content page..


 

<%@ Page language="C#" MasterPageFile="~masterurl/default.master" title="Assign Editor" inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" meta:progid="SharePoint.WebPartPage.Document"%>

<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Import Namespace="Microsoft.SharePoint" %>

<%@ Import Namespace="System.Data" %>

<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<asp:content id="CustomTitle" runat="server" contentplaceholderid="PlaceHolderPageTitle">

Put the custom title here.

</asp:content>

<asp:content id="content2" runat="server" contentplaceholderid="PlaceHolderMain">

table border="0" width="100%" cellspacing="2">

    <tr>

        <td class="ms-formlabel" valign="top" nowrap="true" width="25%">

        <b>Title:</b>

        </td>

        <td class="ms-formbody" valign="top" width="75%">

……………………..

Monday, September 10, 2007

How to restrict copy(ctrl + c) and paste(ctrl + v) functionality of text boxes in web application.

use

oncopy="return false;"

onpaste="return false;"

For example:

<td oncopy = "return false;" onpaste="return false;" >

<asp:TextBox ID="txtEmail" runat="server" Width="284px"></asp:TextBox>

</td>

Monday, September 3, 2007

tujhase naaraaz nahi zindagi

tujhase naaraaz nahi zindagi, hairaan hoon main

o hairaan hoon main

tere masoom savalon se pareshaan hooN main

o pareshaan hoon main


 

jeene ke liye socha hi na tha, dard sambhalane honge

muskuraoon to, muskurane ke karz utaarne honge

muskuraoon kabhi to lagata hai

jaise hontonn pe karz rakhaa hai

tujhase ...


 

aaj agar bhar ayi hai, boondein baras jaayengi

kal kya pata inke liye aakhen taras jayengi

jaane kahan gum kahan khoya

ek aansu chhupake rakha tha

tujhase ...


 

zindagi tere gum ne hamain rishte naye samajhaye

mile jo hamain dhoop main mile chhaanv ke thande saaye


 

o tujhase ...

Monday, August 13, 2007

To create a new event source in EventLog

create a new entry in registry under "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application

" tag.

Step 1. Type regedit in run

Step 2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application

Step 3. Create a new key under application tag. "<Name of the source>"

Step 4. Done.

Create a new event source in EventLog.

To create a new event source in EventLog

create a new entry in registry under "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application

" tag.

Step 1. Type regedit in run

Step 2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application

Step 3. Create a new key under application tag. "<Name of the source>"

Step 4. Done.

Wednesday, August 8, 2007

Web Authentication using windows live id

To authenticate your application using window live id.


 


  1.  

--Note: you are required live id. Please create before start register ur application. You can create live id from (http://login.live-int.com/)

Step to register application


 

  1. Then Integrate in ur login page.
  • Add the below code in your login page.

<iframe

src="http://login.live-int.com/controls/WebAuth.htm?appid=<appid>&context=<context>&style=<style>" width="100px" height="40px" frameborder="0" scrolling="no"> </iframe>

 

Tuesday, August 7, 2007

Wednesday, July 18, 2007

Active Directory configuration on Sharepoint Server

Peoplepicker: Stsadm property (Office SharePoint Server)

Updated: June 07, 2007

Property name: Peoplepicker

The peoplepicker property is part of the setproperty and getproperty operations. The syntax for the setproperty operation is:

stsadm -o setproperty

   -propertyname <property name>

   -propertyvalue <property value>

   [-url] <URL>

The syntax for the getproperty operation is:

stsadm -o getproperty

   -propertyname <property name>

   [-url] <URL>

Description

User information that is imported from directory services is available on the Select People and Groups dialog box, also known as the People Picker Web control. Site administrators and other users use this dialog box to select people and groups when they assign permissions. You are permitted to select users only on the domain that Microsoft Office SharePoint Server 2007 is installed.

When a Web application uses Windows authentication, People Picker will search all two-way trusted forests and all two-way trusted domains. However, if you want to search from a one-way trusted forest or a one-way trusted domain, you must run the setapppassword operation, and then run the peoplepicker -searchadforests property.

Properties

Property (-pn)

Value (-pv)

Description

Example values

peoplepicker-activedirectorysearchtimeout

A valid integer, such as "30"

Configure the timeout when a query is issued to Active Directory.

The default value is "30."

peoplepicker-distributionlistsearchdomains

A valid URL, such as http://server_name

 

Note:

 

The domain name should be a DNS name.

Restricts the search from a search distribution list to be from a specific subset of domains.

http://contoso-370

peoplepicker-nowindowsaccountsfornonwindowsauthenticationmode

Any one of the following values:

Yes

No

Specifies not to search Active Directory when the current port is using forms authentication.

For example, a Web application uses Windows authentication on port 80 and uses forms authentication on port 81. If a user accesses port 81 and attempts a search, results are returned when People Picker is used.

However, when the value is "True," People Picker will only search from the membership provider. If the value is "False," the people picker will search both the membership provider and the Windows Active Directory.

The default value is "Yes."

peoplepicker-onlysearchwithinsitecollection

Any one of the following values:

Yes

No

Displays only users that are members of the site collection.

Only users that are already added to the site collection are displayed in the People Picker. This prevents anyone from browsing your user directory through the People Picker.

A value of "Yes" permits a user to search within their site collection.

A value on "No" does not permit a user to search within their site collection.

peoplepicker-searchadcustomquery

A valid string that specifies the custom query

Permits the administrator to set the custom query that is sent to Active Directory.

Some valid examples are:

(SomeAdAttribute={0})

(SomeAdAttribute={0}*)

(SomeAdAttribute={0})(AnotherAdAttribute={0})

where SomeAdAttribute and AnotherAdAttribute are the names of some indexed attributes in Active Directory.

 

Important:

 

If the property value is not a correct Active Directory query, People Picker will fail. Also, if the searched attribute is not an indexed attribute in Active Directory, the performance of Active Directory will be very slow.

The People Picker can only do wildcard searches for Active Directory Windows group names. With any role provider other than the ones included with Office SharePoint Server 2007, the role provider lookup is specific to the entire name. For example, if you have a group called "Readers" and you enter "Read" in the Select People and Groups dialog box, it will not find your group; if you enter "Readers" it will.

peoplepicker-searchadforests

A valid list of forests or domains

Permits a user to search from a second one-way trusted forest or domain.

By default, Office SharePoint Server 2007 talks only to the domain controller for the domain in which Office SharePoint Server 2007 was installed.

The format of the list of forests or domains value includes the following:

forest:DnsName,LoginName,Password

domain:DnsName,LoginName,Password


 

Note:

 

If "Password" is used, you need to run stsadm –o setapppassword –password <somekey> on every front-end Web server first. The <somekey> could be any string. We will use <somekey> as the key to encrypt the password in the "domain:DnsName,LoginName,Password" or "forest:DnsName,LoginName,Password" and store the encypted password in the database.

However, if the domains or forests are trusted, it is not necessary to pass in the LoginName or Password. The following format is used: forest:DnsName or domain:DnsName.

Examples

Change the Active Directory search timeout

If you have 10 Active Directory directories to search and you do not want to let the user to wait too long, you can configure the timeout to be 10 seconds per Active Directory. To do this, use the following syntax:

stsadm -o setproperty -pn peoplepicker-activedirectorysearchtimeout –pv 10

Restrict a search distribution list to a subdomain

To restrict a search for a distribution list to only be corp.fabrikam.com and ntdev.corp.fabrikam.com, use the following syntax:

stsadm -o setproperty -url http://contoso-370 -pn peoplepicker-distributionlistsearchdomains -pv corp.fabrikam.com;dev.corp.fabrikam.com

 

Note:

 

The domain name should be a Domain Name System (DNS) name and should be separated by a semicolon. If no values were set, all trusted domains or the domains listed in the configuration are searched.

Display users within a site collection

Normally, users that are already added to the site collection are displayed in the People Picker. This prevents anyone from browsing your user directory through the People Picker.

However, in a hosting scenario, you do not want to let the end users to be able to search users from Active Directory. We only want the end users be able to search users that are already in the site collection. But suppose the end user already knows the login name in Active Directory, we still allow end users to invite the user with fully qualified logon name.

If you want users to be able to search within a site collection, use the following syntax:

stsadm -o setproperty –url http://server –pn peoplepicker-onlysearchwithinsitecollection –pv yes

If you do not want users to be able to search within a site collection, use the following syntax:

stsadm -o setproperty –url http://server –pn peoplepicker-onlysearchwithinsitecollection –pv no

Create a custom query in Active Directory

To create a query that searches on the last name, use the following syntax:

stsadm -o setproperty -pn peoplepicker-searchadcustomquery -pn (sn={0}*)

Search additional domains or forests

To enumerate a list of users by using People Picker from a second forest or domain, use the following syntax:

stsadm –o setproperty –pn peoplepicker-searchadforests –pv <list of forests or domains> -url <webapp>

Search membership providers using Windows authentication

Do not search Windows Active Directory when the current port is using forms authentication.

To search from a membership provider only, use the following syntax:

stsadm -o setproperty -url http://server -pn "peoplepicker-nowindowsaccountsfornonwindowsauthenticationmode" -pv yes

To search a membership provider and Windows Active Directory, use the following syntax:

stsadm -o setproperty -url http://server -pn "peoplepicker-nowindowsaccountsfornonwindowsauthenticationmode" -pv no

 

Note:

 

If the value is set to "Yes," the People Picker will not try to search or resolve a user against Active Directory if the current zone does not use Windows authentication.

How to repair (instead of reinstall) sharepoint server configurations!!

setup

Performs configuration for SharePoint Products and Technologies based on the installation mode. Also repairs the configuration. If the product or technology is installed in stand-alone mode, then stand-alone configuration is done. If the product or technology is not in stand-alone mode, you must complete the initial configuration by using the SharePoint Products and Technologies Configuration Wizard instead of the psconfig.exe command-line utility. To run the wizard, on the Start menu, point to All Programs, point to Administrative Tools, and then click SharePoint Products and Technologies Configuration Wizard.

If you want to repair a stand-alone installation, first run setup /repair (for more information, see the Setup Help system), and then psconfig.exe -setup. For server farm installations, after running setup /repair, use the SharePoint Products and Technologies Configuration Wizard instead of the psconfig.exe command-line utility.

Takes the following optional parameter:

[-lcid <1033>]

The locale ID (LCID) that specifies the installation language.

Example

psconfig.exe -cmd setup

Friday, July 13, 2007

Do wa diddy diddy dum

There she was just a walkin' down the street singin'

Do wah diddy diddy dum diddy do

Snappin' her fingers and a shufflin her feet singin'

Do wah diddy diddy dum diddy do


 

She looked good (looked good) She looked fine (looked fine)

She looked good she looked fine, and I nearly lost my mind.


 

Before I knew it she was walkin' next to me singin'

Do wah diddy diddy dum diddy do

Holdin' my hand just as natural as can be singin'

Do wah diddy diddy dum diddy do


 

We walked on (walked on) To my door (my door)

We walked on to my door, then we kissed a little more.


 

Oh, I knew we was fallin' in love.

Yes I did so I told her all the things I've been dreamin' of.


 

Now we're so happy nearly every single day singin'

Do wah diddy diddy dum diddy do

We're so happy and that's how we're gonna stay

Do wah diddy diddy dum diddy do


 

Well I'm hers (I'm hers) And she's mine (she's mine)

Well I'm hers and she's mine, wedding bells are gonna chime.


 

Oh, I knew we was fallin' in love.

Yes I did so I told her all the things I've been dreamin' of.


 

Now we're together nearly every single day singin',

Do wah diddy diddy dum diddy do

We're so happy and that's how it's gonna stay singin',

Do wah diddy diddy dum diddy do


 

Well I'm hers (I'm hers) And she's mine (she's mine)

Well I'm hers and she's mine, wedding bells are gonna chime.

Oh...Oh yeah

Do wah diddy diddy dum diddy do (We're singin)

Do wah diddy diddy dum diddy do

Wednesday, June 27, 2007

Here I am… My faviorite one!!!

Here I am - this is me

There's no where else on earth I'd rather be

Here I am - it's just me and you

And tonight we make our dreams come true


 

It's a new world - it's a new start

It's alive with the beating of young hearts

It's a new day - it's a new plan

I've been waiting for you

Here I am


 

Here we are - we've just begun

And after all this time - our time has come

Ya here we are - still goin' strong

Right here in the place where we belong


 

Chorus X1


 

Here I am - this is me

There's no where else on earth I'd rather be

Here I am - it's just me and you

And tonight we make our dreams come true


 

Chorus X2


 

Here I am - next to you

And suddenly the world is all brand new

Here I am - where I'm gonna stay

Now there's nothin standin in our way

Here I am - this is me

Monday, June 25, 2007

Sharepoint 2007 Errors and Solutions

Situation: While saving site as a template.

Error : The site is too large to save as a template. The size of a template cannot exceed 10485760 bytes.

Solution : Increase size using the command - stsadm -o setproperty -propertyname max-template-document-size -propertyvalue 50000000 .It modifies 10485760bytes size to 50000000(its 50MB).

Friday, June 8, 2007

ADODB.Stream with JavaScript

<script>

function Button1_onclick() {


var octetStream;


var adoStream = new ActiveXObject("ADODB.Stream");

adoStream.Mode = 3; // read

adoStream.Type = 2; // adTypeTexy

adoStream.Charset = "ASCII";

adoStream.Open();

adoStream.LoadFromFile("ssd.txt");


 

octetStream = adoStream.ReadText();


 

alert(octetStream);

}

// ]]>

</script>

<input
id="Button1"
type="button"
value="button"
onclick="return Button1_onclick()"
/>

Tuesday, April 24, 2007