Monday, January 31, 2011

silverlight links

http://blogs.msdn.com/b/joestagner/archive/2008/08/01/44-silverlight-videos.aspx

wcf excepton handling

Exception handling
------------------

step 1:
-------
under web.config(webhost) set to true

 <serviceDebug includeExceptionDetailInFaults="true"/>

step:2
-------
under service.cs

add under namespace(1st stmt)
[ServiceBehavior(IncludeExceptionDetailInFaults=true)]

under code
==========

try
{
  con.open()

}
catch(Exception ex)
{
  throw new FaultException("can't connect to the database");
}


under clint code
------------------

try
{
   customers = proxcy.ListofCustomer();
   customerBindingSource.Datasource = customers;
}
cathch (FaultException faultException) // fault exception occurs i will show this msg.
{
MessageBox.Show(faultException.Message);
}

cathch (FaultException faultException) //any other exception occurs i will show this msg.
{
MessageBox.Show(ex.Message);
}

------------------------------------------------------------------------------------------------------
type2
------------------------------------------------------------------------------------------------------

step 1:
-------
under web.config(webhost) set to true

 <serviceDebug includeExceptionDetailInFaults="true"/>

step:2
-------
under service.cs
----------------

add under namespace(1st stmt)
[ServiceBehavior(IncludeExceptionDetailInFaults=true)]

under code
==========

try
{
  con.open()

}
catch(Exception ex)
{
  throw new FaultException("can't connect to the database",new FaultCode("DBConnection");
}

try
{
  data reader code.......
  while(dr.read())
  {
     obj.value = dr.getString(200); // if problem occuurs here
  }
}
catch(Exception ex)
{
    throw new FaultException("Error reading from the database",new FaultCode(DBReader));
}


under clint code
------------------

try
{
   customers = proxcy.ListofCustomer();
   customerBindingSource.Datasource = customers;
}
cathch (FaultException faultException) // fault exception occurs i will show this msg.
{
    swithc (faultException.code.Name)
    {
       case "DBConnection":
        MessageBox.Show(faultException.Message + "\n\n" + "try again later.", "connection problem");
        break;
        case "DBReader":
         MessageBox.Show(faultException.Message + "\n\n" + "contact the administrator.", "Reading

problem");
        break;
        default:
           MessageBox.Show(faultException.Message + "\n\n" + "contact the administrator.", "unknown

problem");
         break
    }
       
      

}

cathch (FaultException faultException) //any other exception occurs i will show this msg.
{
MessageBox.Show(ex.Message);
}

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

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

type3:

localiging exception message:
-----------------------------

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

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

  strongly typed SOAP FAULTS ( exception handling (client may java or other platform to receive

exceptions))
  -------------------------------------------------------------------------------------------

  1) CREATE ONE OR MORE FAULT CLASSES AND ADD THEM TO THE DATACONTRACT.



   UNDER ISERVICE.CS
   --------------------


   [ServiceContract]
   public interfase Iservice1
   {
      [OperationContract]
      [FaultContract(typeof(ConnectionFault))]
      [FaultContract(typeof(DataFault))]
      string hello();


      [OperationContract]
      [FaultContract(typeof(ConnectionFault))]
      [FaultContract(typeof(DataFault))]
      string hai(string hi);

   }






   UNDER [DATACONTRACT]  ADD TWO NCL
   ====================

   public class ConnectionFault
   {
     [DataMember]
     public string Operation;

     [DataMember]
     public string Reason;


    [DataMember]
     public string Details;
   
   }

   public class DataFault
   {
     [DataMember]
     public string Operation;

     [DataMember]
     public string Reason;


    [DataMember]
     public string Details;
   
   }



  under Service.cs
  -----------------
 

under code
==========

try
{
  con.open()

}
catch(Exception ex)
{
  var connectionFault  = new ConnectionFault();
  connectionFault.Operaion = "hello";
  connectionFault.Reason = "Can't connect to the database";
  connectionFault.Details = ex.Message;
  throw new FaultException<ConnectionFault>(connectionFault,new FaultReason("can't connect to the

database"));  
}

try
{
  data reader code.......
  while(dr.read())
  {
     obj.value = dr.getString(200); // if problem occuurs here
  }
}
catch(Exception ex)
{
   var dataFault  = new DataFault  ();
  dataFault.Operation  = "hello";
  dataFault.Reason = "Error reading from the database";
  dataFault.Details = ex.Message;
  throw new FaultException<DataFault>(dataFault,new FaultReason("Error reading from the database"));
}


under client
===========================


under clint code
------------------

try
{
   customers = proxcy.ListofCustomer();
   customerBindingSource.Datasource = customers;
}

catch(FaultException<ConnectionFault>connectionException)
{
   MessageBox.Show(String.Format("{0}\n\n" + "The following occured in {1}:\n{2}",
   connectionException.Detail.Reason,
   connectionException.Deatil.Operation,
   connectionException.Detail.Details),
   "connction problem");
}

catch(FaultException<DataFault>dataException)
{
   MessageBox.Show(String.Format("{0}\n\n" + "The following occured in {1}:\n{2}",
   connectionException.Detail.Reason,
   connectionException.Deatil.Operation,
   connectionException.Detail.Details),
   "reading problem");
}

consuming wcf service in java

http://romenlaw.blogspot.com/2008/07/consuming-wcf-web-service-using-java.html


package svdemo;
02.import org.datacontract.schemas._2004._07.svdemo.PromoInfo;
03.import org.tempuri.*;
04. 
05.public class Program {
06. 
07. /**
08.  * @param args
09.  */
10. public static void main(String[] args) {
11.  IPromoService service=(new PromoService()).getBasicHttpBindingIPromoService();
12.  String keywords="action";
13.  if(service.hasPromo(keywords)) {
14.   PromoInfo promo=service.getFirstPromo(keywords);
15.   System.out.println("promo:"+promo.getPromoName().getValue()
16.     +","+promo.getPromoDateTime());
17.  } else {
18.   System.out.println("nothing");
19.  }
20. }
21.}

Saturday, January 29, 2011

CONVERT ANY CRYSTALREPORT TO PDF

 SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            saveFileDialog1.Filter = "Your extension here (*.pdf)|*.pdf|(*.docx)|*.docx|All Files (*.*)|*.*";
            saveFileDialog1.FilterIndex = 1;
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                ExportOptions CrExportOptions;
                DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();

                PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
                string sFilename = saveFileDialog1.FileName;
                CrDiskFileDestinationOptions.DiskFileName = sFilename;
                CrExportOptions = reportDocument.ExportOptions;
                {
                    CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
                    CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
                    CrExportOptions.FormatOptions = CrFormatTypeOptions;
                }
                reportDocument.Export();
                MessageBox.Show("Your document saved sucessfully.");

Saturday, January 22, 2011

Creating a XML document with C#


Creating a XML document with C#




Just try this short piece of code, to make an XML document on the fly.In C# working with XML through the System.XML is very easy.

using System;
using System.Xml;

namespace PavelTsekov
{
class MainClass
{
XmlDocument xmldoc;
XmlNode xmlnode;
XmlElement xmlelem;
XmlElement xmlelem2;
XmlText xmltext;
static void Main(string[] args)
{
MainClass app=new MainClass();
}
public MainClass() //constructor
{
xmldoc=new XmlDocument();
//let's add the XML declaration section
xmlnode=xmldoc.CreateNode(XmlNodeType.XmlDeclaration,"","");
xmldoc.AppendChild(xmlnode);
//let's add the root element
xmlelem=xmldoc.CreateElement("","ROOT","");
xmltext=xmldoc.CreateTextNode("This is the text of the root element");
xmlelem.AppendChild(xmltext);
xmldoc.AppendChild(xmlelem);
//let's add another element (child of the root)
xmlelem2=xmldoc.CreateElement("","SampleElement","");
xmltext=xmldoc.CreateTextNode("The text of the sample element");
xmlelem2.AppendChild(xmltext);
xmldoc.ChildNodes.Item(1).AppendChild(xmlelem2);
//let's try to save the XML document in a file: C:\pavel.xml
try
{
xmldoc.Save("c:\pavel.xml"); //I've chosen the c:\ for the resulting file pavel.xml
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
Console.ReadLine();
}
}
}


http://www.csharphelp.com/2006/05/creating-a-xml-document-with-c/

Thursday, January 20, 2011

iis hosting errors when we try to host our app in ii7(production side)


access denied and cannot have access permissions

to config file

http://support.microsoft.com/kb/942055


forbidden access

http://support.microsoft.com/kb/942062/en-us


creating proxy class for webservice
-------------------------------------

http://www.exforsys.com/tutorials/vb.net-2005/instantiating-invoking-web-services-creating-proxy-classes-with-wsdl.html



Wednesday, January 12, 2011

varmaphone

if write both better for every appliction to maintaing state temprarly
-----------------------------------------------------------------------

1)to store data in temparary
----------------------------
 PhoneApplicationService phappserv = PhoneApplicationService.Current;


         protected override void  OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
         {
            phappserv.State["myvalue"] = textBox1.Text;
             base.OnNavigatedFrom(e);
         }

         protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
         {
             object somevalue ="";
             if (phappserv.State.ContainsKey("myvalue"))
             {
                 if (phappserv.State.TryGetValue("myvalue", out somevalue))
                 {
                     textBox1.Text = somevalue.ToString();
                 }
             }
             base.OnNavigatedTo(e);
         }





2)tostore data for longterm
--------------------------

in app.xaml
-------------

helper methods
---------------

  private void savestate()
    {
        PhoneApplicationService phoneappservice = PhoneApplicationService.Current;

       IsolatedStorageSettings   settings = IsolatedStorageSettings.ApplicationSettings;
        settings["myvalue"] = phoneappservice.State["myvalue"];
    }

    private void loadstate()
    {
        PhoneApplicationService phoneappservice = PhoneApplicationService .Current;

        IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

        string myvalue = "";
        if(settings.TryGetValue<string>("myvalue",out myvalue))
        {
             phoneappservice.State["myvalue"] = myvalue;
        }
      
    }

call these methods under
------------------------

 private void Application_Launching(object sender, LaunchingEventArgs e)
        {
             loadstate();
        }

        // Code to execute when the application is activated (brought to foreground)
        // This code will not execute when the application is first launched
        private void Application_Activated(object sender, ActivatedEventArgs e)
        {
            loadstate();
        }

        // Code to execute when the application is deactivated (sent to background)
        // This code will not execute when the application is closing
        private void Application_Deactivated(object sender, DeactivatedEventArgs e)
        {
            savestate();
        }

        // Code to execute when the application is closing (eg, user hit Back)
        // This code will not execute when the application is deactivated
        private void Application_Closing(object sender, ClosingEventArgs e)
        {
            savestate();
        }


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

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

synario: for example few files are there in isolated storage

prob:  how to get filenames,which are stored in isolated storage

sol:
    

        isolatedstoragefile(variablename) = IsolatedStorageFile.GetuserStoreforappication();

         
         listbox.itemssource = isolatedstoragefile.GetFilenames();

        //we need bind the property in the souce code also
           
       i.e,(Content="{Binding})

             <ListBox Height="200" HorizontalAlignment="Left" Margin="12,25,0,0" Name="listBox1"

VerticalAlignment="Top" Width="460" Background="Red" Visibility="Collapsed">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                           
                            <HyperlinkButton Content="{Binding}" Click="HyperlinkButton_Click" >
                               
                            </HyperlinkButton>
                        </DataTemplate>
                    </ListBox.ItemTemplate>

                </ListBox>


      in listbox i have links visible like this


                file1.txt
                ---------

                file2.txt
                ---------

                file3.txt
                ---------
  when user clicks any file he need to navigate another page with relavent filename with relavent content for that

the below code

          private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
        {
            // i need to write code here............

            HyperlinkButton  h = (HyperlinkButton)sender;

            // i am contructing the uri

            string uri = string.Format("/WindowsraviPhoneApplication2;component/Page1.xaml?id={0}", h.Content);

            NavigationService.Navigate(new Uri(uri, UriKind.Relative));



        }


  in the destination load event the code as follows

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

 private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            IsolatedStorageFile isostrofile = IsolatedStorageFile.GetUserStoreForApplication();
            string filename = "";
           // string filename = NavigationContext.QueryString["id"];

           if(NavigationContext.QueryString.TryGetValue("id",out filename))
           {
             
            using (var file = isostrofile.OpenFile(filename, System.IO.FileMode.Open, FileAccess.Read))
            {
                StreamReader sr = new StreamReader(file);
               textBlock1.Text = sr.ReadToEnd();
            }
           }
            
        }


http://blogs.msdn.com/b/mingfeis_code_block/archive/2010/10/03/windows-phone-7-how-to-store-data-and-pass-data-

between-pages.aspx



  http://innovativesingapore.com/2010/09/code-how-to-store-data-and-pass-data-in-windows-phone/(data sotre permentely)

Tuesday, January 11, 2011

windowsphone

content pannel is a grid, is like body in html


grid
canvas
stack pannel

if you want to put your control in center
horizontal,vertical alignment-->stretch and remove the margin


grid
--------



<grid>
<grid.rowdefinitions>
<rowdefinfinition height="80"/>
<rowdefinfinition height="80*"/> --->additional space
</grid.rowdefinitions>

<grid.columndefinitions>
<columndefinition height="100"/>
<columndefinition height="100*"/> --->additional space
</grid.columndefinitions>

<Button: width="" height="" content="" grid.row="0" grid.column="1"/>

</grid>


<stackpanel>(in new page)
----------------

all the controls in stackpanel will be in vertical


<canvas>(in new page)

if you want to place controls in various places then canvas will be the choice.


silverlight events
----------------------------------

for eg:

2 buttons pointed to same event to identify which button user clicks

< button height="" width="" content="button1" click="button1_click"/>
< button height="" width="" content="button2" click="button1_click"/>

under button1_click event handler
--------------------------------

button b = (button)sender;

textblock.text = n.name;


silverlight input controls
------------------------------

<scorllviewer viewer height="" width="" margin="0,0,0,0" verticalscrollbarvisibility="visible">

if you add any control in this it is better

 </scorllviewer>


image control
--------------------
drag the image and set the datasource property from the property window

remember the path:/images;component(refer to xapfile)/images.koala.jpg

stretch property set to uniform            from properties window

under load_click
-----------------
<scrolviewer margin="" scrollbarvisibility=visible">

BitmapImage IMA = NEW BitmapImage(new uri("/images;component/images/penguins.jpg",urikind.relative));
image1.source = ima;
</scrollviewer>

Resources and styles
--------------------------
theme resources for windows phone(bing)--------->binding syntax
eg: <button ------------------- borderbrush="{staticresource -----------}"

to use the same foreground property to same another button follow the steps

go to property window---->foreground rt click exctract-> key:somename  destination:yourwish


if you want to create style
-------------------------------

<phone:phoneApplicationPae.Resources>
<style x:key="ravistyle" target="button">
<setter property ="borderbrush" value="red"/>
<setter property ="foreground" value="red"/>
</style>
</phone:phoneApplicationPae.Resources>


<button ------------------style="{staticresource ravistyle}"/>


Navigating b/w pages:
-----------------------------
Navigateuri(from properties window) = /projectname/component/page1.xaml

passing info b/w pages
------------------------
first page

Navigateuri(from properties window) = /projectname/component/page1.xaml?id=1


reading value in another page
=============================

underloaded event
-------------------

textbox1.text = string.format("value:{0}",navigationcontext.querystring["id"]);



when we reading the qierystring in another page(if the value not comes to that page then(safty precation))

stirng id="";
if(NavigationContext.Querystring.TryGetvalue("id",out id))
{
   textbox1.text = string.format("value:{0}",id);
}



maiantaing state in textbox when we navigating other pages
-------------------------------------------------------------


under mainpage.xml.cs
-----------------------

protected override void onNavigatedFrom(System.windows.Navigation.NavigationEventsArgs e)
{
  phoneAppService.State["myvalue"] = textbox1.text;
  base.OnNavigatedFrom(e);
}

protected override void onNavigatedTo(System.windows.Navigation.NavigationEventsArgs e)
{

  object someobject;
  if(phoneAppservice.State.ContainsKey("myvalue"))
{
  if( phoneAppService.State.TryGetvalue("myvalue",out someobject))
  {
   textbox1.text = someobject.tostring();
  }
}
 base.onnavegatedTo(e);
}






application bar
-------------------------
c:\programfiles\microsoftsdks/windows7/versoin7/dark/ (to findout images like  + ,- ?)

build action = content(mandatory)

remove the comments on application bar code in source code

set the iconruri = your path


using cnavas dialog(important visible and collapse)
-------------------------------------------


<button--------------------- click=openbutton_click/>
//to creata a dialog

<canvas ---------------visibility="collapsed"/>
<textblock-----------------/>
<button----------------------/>
</canvas>


under openbutton_click
---------------------

mydialog.visibility = system.windows.visibility.visibile;

under clostbutton_click
----------------------

mydialog.visibility = system.windows.visibility.collapse;


isolated storage:
-----------------------------

under save_click
--------------------

var appstorage = isolatedstorageFile.getuserstorageforapplication();
string filename = "ravi.text";

using (var file = appstorage.openfile(filename,system.io.filemode.openorcreate,system.io.fileassceess.write))
{
  using (var writer = new streamwriter(file))
{
  writer.write(textbox1.text);
}
}


under open_clcik
---------------------


using (isolatedstoragefile store = isolatedstoragefile.geruserforapplication())
{
  using (streamreader sr = new streamreader(store.openfile("ravi.text",filemode.open,fileaccess.read)))

 {
    textbox1.text = sr.readtoend();
 }
}

note: when your shutdown or pc then the data in isolated area will be arased


isolated listbox and templates
---------------------------------

take one listbox in grid_content(source code)

<listbox----------------->
<listbox.itemtemplate>
<datatemplate>
<hyperlinkbutton name="" content"{binding}" click="filename_linkbutton_click"/>
</datatemplate>
</listbox.template>
</listbox>

<button content="load samples"----------- click="loadsamplesbutton_click"/>


under loadsamplesbutton_click
-----------------------------
var appstorage = isolatedstoragefile.getuserstoreforapplication();

  if(!appstorage.fileexists("text1.txt"))
    {
           using (var file = appstorage.createfile("text1.txt"))
      {
            using (var writer = new streamwriter(file))
        {
              writer.writeline("this is the first test");
        }
       }
    }






private void loadsamplesbutton_click(object sender,routedeventargs e)
{
   createsamples("test1.txt","this is the first test");
   createsamples("test2.txt","this is the secound test");
   createsamples("test3.txt","this is the third test");
bindlist();

}






//helper method
----------------

private void createsample(string filename,string filecontent)
{
  

  var appstorage = isolatedstoragefile.getuserstoreforapplication();

  if(!appstorage.fileexists(filename))
    {
           using (var file = appstorage.createfile(filename))
      {
            using (var writer = new streamwriter(file))
        {
              writer.writeline(filecontent);
        }
       }
    }

}


phoneapplicationpage_loaded event
{
  bindlist();
}

//helper method

private void bindlist()
{
  var appstorage = isolatedstoragefile.getuserstoreforapplication();
string[] filelist  = appstorage,getfilename();
filelistbox.itemsource = filelist;
}

under filenamelinkbutton_click
--------------------------------

  hyperlinkbutton h = (hyperlinkbutton)sender;
  string uri =  string.format("isolatedstoragelisting;component;/secondpage.xml?id={0}", h.content);
Navigationservice.navigae(new uri(uri,uriking.relative));









under secondpage
---------------------------

under loaded event
--------------------

var appstorage = isolatedstoragefile.getuserstoreforapplication();

string filename = NavigationContext.querystring["id"];
using (streamreader sr = new streamreader(appstorage.openfile(filename,system.io.filemode.open))
{
 displaytextblock.text = sr.readtoend();
}


to know the isolate storage(how much place availble)
-----------------------------------

textbox1.text  =  string.format("free:{0}",appstorage.availablefreespace.tostring());

textbox2.text  =   string.format("quota:{0}",appstorage.quota.tostring());



maintaing state when navigating b/w pages(backbutton and start button event though emulator closed we will get the

information back which is stored in isolated storage)--->toomstoning
===========================

phoneapplicationservice phoneappservice = phoneapplicationservice .current;
under textchanged event
----------------------------

{
     phoneappservice.state["myvalue"] = textbox.text;
}


under loaded event
----------------------

object myvalue;

if(phoneappservice.state.containskey("myvalue")
{
if(phoneappservice.state.trygetvalue("myvalue",out myvalue))
{
   textbox.text = myvalue.tostring();
}
}

under appxaml.cs
---------------------


helpermethod
-------------

privat void savestate()
{
  phoneapplicationservice phoneappservice = phoneapplicationservice .current;

isolatedstoragesetting settings = isolatedstoragesettings.applicationsettings;
settings["myvalue"] = phoneappservice.state["myvalue"];
}

private void loadstate()
{
  phoneapplicationservice phoneappservice = phoneapplicationservice .current;

isolatedstoragesetting settings = isolatedstoragesettings.applicationsettings;

string myvalue = "";
if(settings.trygetvalue<string>("myvalue",out myvalue))
{
   phoneappservice.state["myvalue"] = myvalue;
}
      
}


appliction_launching    
---------------------
loadstate()

application_activated
----------------------
loadstate()

application_deactivate and application_closing
-----------------------------------------------

savestate()




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

adding different inputscopes

ref: inputscopenamevalue enumeration(bing)


<textbox ----------------->
 
<textbox.inputscopt>
<inputscope>
<inputscopename =namevalue="text"/>
</inputscope>

</textbox.inputscopt>

</textbox>


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


gps:
-----------


add reference----------> system.device

namespace: using system.device.loaction


under button_click
---------------------

geocoorenatewatcher mywatcher = new geocoorenatewatcher ();

var myposition  = mywatcher.position;

double latitude = 47.674;
double longitude = -122.12;

if(!myposition.location.isknown)
{
   latitude = myposition.location.latitude;
   longitude = myposition.location.longitude;
}


http://msrmaps.com/webservice.aspx-----------------(free websericess)


how to access service in client
--------------------------------

 servicereference1client client = new  servicereference1client ();
 client.convertlonlarpttonearestplacecompleted + - press tab tab ;
client.convertlonlarpttonearestplaceasync(new servicereference1.lonlanpt{lan = latitude,lon = longitude});

void someevent (it will automatically generate
{
   textbox1.text = e.result;
}
  
-------------------------------------------------------------------------------------------------------------------

changing background
----------------------

supprotedorientation property set to portrteorlanscape

under edit_click
----------------

if(textbox1.visibility ==  system.windows.visibility.visible)
{
        button.content = "edit";
                textblock1.text = textbox1.text;
                textbox1.visibility = system.windows.visibility.collapsed;
                textbolck1.visibility = system.windows.visibility.visible;  
}
else
{
    button.content = "save";
    textbox1.text = textblock1.text;
    textbox1.visibility = system.windows.visibility.visible;
    textbolck1.visibility = system.windows.visibility.collapsed;  
     
}




SQL Style ID    SQL Style    Example
0 or 100    mon dd yyyy hh:miAM (or PM)    Jan 15 2008 5:44PM
101    mm/dd/yy     01/15/2008
102    yy.mm.dd     2008.01.15
103    dd/mm/yy     15/01/2008
104    dd.mm.yy    15.01.2008
105    dd-mm-yy    15-01-2008
106    dd mon yy     15 Jan 2008
107    Mon dd, yy     Jan 15, 2008
108    hh:mm:ss     17:42:33
9 or 109    mon dd yyyy hh:mi:ss:mmmAM (or PM)     Jan 15 2008 5:42:09:953PM
110    mm-dd-yy     01-15-2008
111    yy/mm/dd     2008/01/15
112    yymmdd (no spaces)    20080115
13 or 113    dd mon yyyy hh:mm:ss:mmm(24h)    15 Jan 2008 17:37:13:163
114    hh:mi:ss:mmm(24h)     17:37:52:407
20 or 120    yyyy-mm-dd hh:mi:ss(24h)     2008-01-15 17:38:20
21 or 121    yyyy-mm-dd hh:mi:ss.mmm(24h)     2008-01-15 17:38:44.867
126    yyyy-mm-dd Thh:mm:ss.mmm(no spaces)     2008-01-15T17:39:12.193

Friday, January 7, 2011

iis hosting

for iis hosting  in vs2008, 2010

   1. Run Visual Studio 2008 Command Prompt as “Administrator”.
   2. Navigate to C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation.
   3. Run this command servicemodelreg –i.



for hosting in the network disable the firewall


while programming in asp.net in iis appalication pool

advanced setting identiti=network service

debug=true

enableviewstatemac=false for every .aspx page




 in vs2010
for regsitry the asp.net 4.0 in iis

cmd -----run as administrator

 C:\Windows\Microsoft.NET\Framework\v4.0\aspnet_regiis -i

json with wcfservice

WCF
====

IF YOU WANT TO CHANGE YOUR SERVICE TO JSON

YOU NEED TO FOLLOW BELOW STEPS
================================
 
YOU NEED TO ADD REFERENCE:using System.ServiceModel.Web;(C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5  go to this path if not found).
1) IN iSERVICE1
   ==============
  [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "listofcities")]
        List<cities> listofcities();

UNDER SERVICE1
2) AT TOP
  
    // NOTE: If you change the class name "Service1" here, you must also update the reference to "Service1" in App.config.

    [ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]
======================================================================(ADD THIS ONE(********))
    public class Service1 : IService1
    {


3) IN HOST WEB.CONFIG
======================   (in 2010 vs you need to add one endpoint explicitely)

</serviceBehaviors>
=======================
      <endpointBehaviors>
        <behavior name="WEB">
          <webHttp/>
        </behavior>
      </endpointBehaviors>

PUT THE NAME="WEB" IN ENDPOIN TAG
==================================

 <endpoint address="" binding="webHttpBinding" contract="restarentlib.IService1" behaviorConfiguration="WEB">