Surendra Sharma

Surendra Sharma

Search This Blog

Showing posts with label ASP.NET. Show all posts
Showing posts with label ASP.NET. Show all posts

Monday, June 17, 2019

Total Page View Crossed 250000

I am very excited to share that today my Sitecore blogpost crossed magical number 250,000+ page view all time.

Thanks for all the visitors and followers. I started this blog to share my ideas and findings with rest of the world. I hope this help people around the world in some useful and meaningful ways.

I will continue to share my real life experiences with you all in same way.

Stay tuned for some upcoming cool ideas ,implementations and sample code.

Pageviews all time history
Pageviews all time history

Thursday, June 1, 2017

Solved : The content type of the response message does not match the content type of the binding

If you are adding any SOAP web service as just "Add Service Reference..." in Visual Studio and receiving below error at runtime in your code
System.ServiceModel.ProtocolException was unhandled
  Message=The content type text/xml; charset=utf-8,text/xml; charset=UTF-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<?xml version="1.0" encoding="UTF-8"?>

Follow below steps to fix this

  • Right click on VS project
  • Click on "Add Service Reference..."
  • Click on "Advanced..."
  • Click on "Add Web Reference..."
  • Enter service URL and click on Go arrow button
  • Enter Web Reference name and click on Add Reference
In short add SOAP service as a "Web Service" and don’t by just Service Reference in Visual Studio.

Please leave your comments or share this tip if it’s useful for you.

Thursday, January 12, 2017

How to publish a single file in Visual Studio

I just learn a new secret of Visual Studio.

There are almost 10 projects in my single solution in Visual Studio. Every time if I make the changes in any file I have to build and publish it again to verify the changes on browser. If some code file is there than it’s understood that we have to build the solution and publish it. 

However if some static file is there like HTML, ASPX, XML, JS, CSS etc., still I was build the whole project and publish it where no code changes are involved. Ultimately to test the page I have to reload my web application which take enough time.

But Visual Studio provide a nice feature of publishing only a single file. This feature is very useful if file is static like HTML, aspx, XML, JS, CSS, image etc. You can also publish the code file as well.

You can use any of the mentioned way to use this feature

  • Just right click on file in Solution Explorer and select "Publish <FileName>".

  • Shortcut command is "Alt+; Alt+P".

Publish File from Solution Explorer
Publish File from Solution Explorer

  • Project Menu -> "Publish <FileName>".

Publish File from Project Menu
Publish File from Project Menu

It publish the single file within a fraction of second and now if you reload the page it will load quickly in browser.

I hope you like this hidden secret of Visual Studio. Stay tuned for more articles.

Please leave your comments or share this tip if it’s useful for you.

Wednesday, October 26, 2016

How to change style of items in Sitecore

I just love the way Sitecore allow me to customize its UI, change look and feel, override pipeline etc.

Sitecore provides a web UI to user which is ultimately HTML for browser. So everything that is applicable on HTML is also true for Sitecore UI.

There are some important items present in content tree which we need to show to content editor in different format. So sometimes we need to change look and feel of these item in content tree.

Content items in tree are actually <span> inside Hyperlink HTML tags.

Before applying any style, my content tree looks like

Before applying style
Before applying style

For applying style to item,

  • Select item
  • Select Standard fields checkbox in View Tab
  • Open "Appearance" section
  • Put you CSS style into "Style" field.
  • Refresh your content tree.

I am using below style for two items
  • color:red;
  • font-size: 24px;color:orange;background-color:black

Once you put this style and refresh content tree, now my content tree looks like

After Applying style
After Applying style

Sitecore add this style to <span> tags inside hyperlink at runtime as

<span style="font-size: 18px;color:orange;background-color:black"><img src="/temp/IconCache/Applications/16x16/Document.png" width="16" height="16" class="scContentTreeNodeIcon" alt="" border="0">List 2</span>

Style in span
Style in span

I hope you like this Sitecore customization lesson. Stay tuned for more Sitecore related articles.

Till that happy sitecoring :)

Please leave your comments or share this article if it’s useful for you.