Thu 15 Apr 2010

To view the detailed error information for generic error against 500 Internal Server Error

internal+server+error.jpg

By default, Windows hosting servers display a generic error when any .NET application generates an exception. They display a generic error because the detailed error messages allow a malicious user to obtain sensitive information.

To troubleshoot the error, you can modify your web.config file and specify that a custom error message displays. A custom error message helps you to locate the specific code that is causing the issue.

CAUTION: The code samples we provide below do not constitute a complete web.config file. Do not replace your existing web.config file with the code we provide. Before changing your web.config file, we recommend creating a backup.

 

Displaying Custom Error Messages / Enabling Detailed Errors on IIS 6

Use the sample code below to display custom error messages on IIS 6:

<configuration>
    <system.web>
        <customErrors mode="Off"/>
        <compilation debug="true"/>
    </system.web>
</configuration>



Displaying Custom Error Messages / Enabling Detailed Errors on IIS 7

Use the sample code below to display custom error messages on IIS 7:

<configuration>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
        <asp scriptErrorSentToBrowser="true"/>
    </system.webServer>
    <system.web>
        <customErrors mode="Off"/>
        <compilation debug="true"/>
    </system.web>
</configuration>

 

=========================

 

Tags:
Comments here
Thu 18 Mar 2010

Watch this video. Think before you post on Facebook. Specially for girls.

Precautions required if you want to be safe in this evil world.

Be Careful & Take Care...

======================================================================================================== 

========================================================================================================


To control your privacy that only the person you know can view your posts, photos, and other personal information, follow the following instructions

 Click on Account link on top right corner of facebook page. Then click on Privacy Settings, following page will be displayed.

 

Facebook+Privacy+2010+a.JPG

 

To set privacy settings of your personal information, click on Personal Information.

To set privacy setting of your contact information, click on Contact Information

 

Facebook+Privacy+2010+b.JPG

 

 

 

Set all drop down value to Only Friends by selecting it after click on the dropdown. So only your friends can see your personal / contact information.

 

Facebook+Privacy+2010+c.JPG

========================================================

 

Facebook+Privacy+2010+d.JPG

 

Hope this will help you to secure your personal information to some extent.


Be aware of the Evil World. Think before you post, any where, over the Internet

 

Categories : Thoughts / Lessons
Comments here
Mon 15 Mar 2010

This post posted by Vladimir Kuzin on 15th Oct 2009. For Quick reference posted here.

Few weeks ago I was working on project which required data to be encrypted using C# and then decrypted using JavaScript. In my case JavaScript was an internal scripting language, which wasn’t exposed to public so I didn’t have to worry about people accessing encryption keys. Project objective was to encode parameter in URL preventing users from substituting it with sequential numbers.

Research:

At first I’ve decided to use symmetric algorithm and looked online for available JavaScript libraries. In my search I’ve found few AES libraries to choose form. After further analysis it was determined that most people had good luck with slowAES, and I’ve attempted to implement it. After spending some time I was unable to decrypt any data encoded with RijndaelManaged class in C#. Since I had to find solution fast I’ve moved on.

Next I’ve decided to try asymmetric encryption algorithm, and after quick research I went with RSA. After downloading most popular RSA library for JavaScript I’ve run into several issues with its implementation. I was able to use C# to decode everything what was encoded in JavaScript, but it didn’t work when data was flowing in opposite direction. After looking into the issue it appeared that JavaScript library was missing padding, however using patched versionof the library didn’t help.

Solution:

Due to lack of time I’ve decided to use simpler encryption algorithm and went with RC4. After downloading RC4 JavaScriptlibrary I’ve got it to work within minutes. Since there is no such thing as RC4 cryptographic provider in the Security.Cryptography namespace I had to use open source RC4 library.

After encrypting data I’ve also converted it to hex (base 16) in the same way as it was done on the JavaScript RC4 demo page.

Encrypting URL parameter with RC4 didn’t completely meet the objective, since it still was possible for users to use sequential numbers. Take a look at example of encrypted data below:

Input Output
10001 49845da1c0
10002  49845da1c3

Notice that only last digit of the encrypted data has changed, therefore substituting it with sequential numbers will cause an issue. To solve this I’ve added random prefix and suffix blocks to data before encrypting. Prefix and suffix blocks consisted from random letters and were anywhere between 10 and 25 characters in length. Now data looked like this:

Input:
JQNLAZXAHHSHMIL;10001;GURUOTCBBNHDCZUNFXIGKP
Output:
32e523ddb00fbf2465002bc1b4251dd12876677d47d6a 6a3101a68517dfb6a86fa525139300d65225e365a38

Every time encrypted value is changing, since it’s generated from new random data. After transferring and decrypting this data on the JavaScript side I’ve spited string by semicolon to get the actual parameter value.

I am sure there are different and possibly better solutions somewhere out there, but this one worked for my client and was implemented within a small project budget.

This is post is from original Post @ vkuzin.com/post/Passing-encrypted-data-between-C-and-JavaScript.aspx

 

Tags: , ,
Comments (3)
Sat 27 Feb 2010

Jashn-e-Eid Milad Un Nabi Mubarak

 (صلی اللہ علیہ وسلم)

Happy Birthday of Prophet Muhammad sallalLaho alaihi wassallam

12 - Rabi ul Awwal 

-------------------------------

Eid+Milad+un+Nabi+Muhammad+BirthDay+Celebration+1.jpg

 

Eid+Milad+un+Nabi+Muhammad+BirthDay+Celebration+4.jpg

 

Eid+Milad+un+Nabi+Muhammad+BirthDay+Celebration+5.jpg

 

 

 Eid+Milad+un+Nabi+Muhammad+BirthDay+Celebration+2.jpg

 

Eid+Milad+un+Nabi+Muhammad+BirthDay+Celebration+3.jpg

 

Eid+Milad+un+Nabi+Muhammad+BirthDay+Celebration+6.jpg

 

Eid+Milad+un+Nabi+Muhammad+BirthDay+Celebration+7.jpg

 

Eid+Milad+un+Nabi+Muhammad+BirthDay+Celebration+8.jpg

 

Eid+Milad+un+Nabi+Muhammad+BirthDay+Celebration+9.jpg

 

Eid+Milad+un+Nabi+Muhammad+BirthDay+Celebration+10.jpg

 

Eid+Milad+un+Nabi+Muhammad+BirthDay+Celebration+11.jpg

 

Eid+Milad+un+Nabi+Muhammad+BirthDay+Celebration+12.jpg

 

Eid+Milad+un+Nabi+Muhammad+BirthDay+Celebration+13.jpg

 

Eid+Milad+un+Nabi+Muhammad+BirthDay+Celebration+14.jpg

 

Eid+Milad+un+Nabi+Muhammad+BirthDay+Celebration+15.jpg

-------------------------------

Date Updates 

24 Jan 2013 - Saudia / UAE  --- 25 Jan 2013 - Pakistan 

25 Feb 2010 - Saudia / UAE  --- 26 Feb 2010 - Pakistan

-------------------------------

 
Categories : Reality of Islam
Comments (3)
Fri 12 Feb 2010

SPWeb has two sharepoint cross-site group collection, SPWeb.Groups and SPWeb.SiteGroups.

SPWeb.Groups returns collection of cross-site groups which has some permission on the site. So if you add group from a site without any permission on the site, then this group wont appear in SPWeb.Groups collection, but it will appear in SPWeb.SiteGroups collection.

You can not use SPWeb.Groups.Add method to add new cross-site group, you need to use SPWeb.SiteGroup.Add method for this purpose.

In addition to this SPWeb has a property AssociatedOwnerGroup, which will return the required SPGroup. You can iterate the SPGroup users to get the list of all owners of the site.

 foreach (SPUser user in web.AssociatedOwnerGroup.Users)
 {
      // .. list all the users                        
 }

 

Finding and adding group

SPGroup  group = GetSiteGroup(web, "groupName");
if (null == group)
{
 web.SiteGroups.Add("groupName", web.AssociatedOwnerGroup, null, "Test Group description");
}

 


private static SPGroup GetSiteGroup(SPWeb web, string name)
{
    foreach (SPGroup group in web.SiteGroups)
    {
 if (group.Name.ToLower() == name.ToLower())
 {
     return group;
 }
    }
 return null;
}

 

 

Tags: , ,
Comments here
Thu 28 Jan 2010

Accessing JD Edwards Data on iSeries or AS/400 from a ASP.NET

Facing problem, while retrieving field data from JD Edwards to SQL (SSRS Reporting), giving Error or Special unicode characters,
because, the returning data was a stream that needs to be converted into ASCII (ebcdic37String) using Cp037 Encoding.


public static String convertEBCDIC37ToUnicode(String ebcdic37String)
{
 String encoding = "Cp037";
 byte[] ebcdic;
 String converted = null;
 try
 {
  ebcdic = ebcdic37String.getBytes();
  converted = new String( ebcdic, encoding );
 }
 catch (Exception e)
 {
  //Handle it
 }
 return converted;
}

 

Comments here
Thu 28 Jan 2010

Few days before, I was having problem that after clicking on Export to pdf button / image, other controls of web part/user control stops working on the application page on WSS 3.0 environemnt that has RadGrid on it.

While the same thing was working on other asp.net application outside the sharepoint environment.

1st workaround (can be a solution)

The cause for this behavior is that there is a flag (named _spFormOnSubmitCalled) in SharePoint which prevents double form submition. This flag is set when the form is submitted and clear when the response is received.
However when exporting the response is redirected and the page is not updated, thus the flag is not cleared and page's postbacks are blocked.

In order to workaround this behavior you should manually clear the flag when exporting. This can be achieve, for example in export button's client click function similar to the following:

MyExportButton.OnClientClick = "_spFormOnSubmitCalled = false;"  

Above workaround will allow you to export multiple times, but all the other controls on the page were still not functional after the export.

2nd workaround (Not / Never recommended)

In your sharepoint master page, remove onsubmit attribute from your form tag

<form runat="server" onsubmit="return _spFormOnSubmitWrapper();"> 

and remove the onsubmit attribute.  This is what it looks like now:

<form runat="server"> 

3rd workaround (so far so good and implementable)

Add the following script to your webpart / custom control that need to have export and other controls functionals, rather then implementing the above workarounds
So here you go with the working solution.

<script type="text/javascript" language="javascript">

    //sharepoint postback to work after clicking on telerik export to pdf
    if (typeof (_spBodyOnLoadFunctionNames) != 'undefined' && _spBodyOnLoadFunctionNames != null) {
        _spBodyOnLoadFunctionNames.push("supressSubmitWraper");
    }

    function supressSubmitWraper() {
        _spSuppressFormOnSubmitWrapper = true;
    }
   
</script>

 

Hope this will helps.

 

Comments (23)




Ads