Forum Replies Created
- AuthorPosts
Pavan
MemberI think that you can show a video as background with the help of some css and styling such as:
<body> <div style="background:red;height:100px;width:100px;position:absolute""> </div> <video width="100%" height="100%" style="position:absolute; z-index:-1" controls autoplay> <source src="movie.mp4" type="video/mp4"> </video> </body>
Pavan
MemberIts a page directive attribute that is used for security point.
true if the view state should be MAC checked and encoded; otherwise, false. The default is true.
A view-state MAC is an encrypted version of the hidden variable that a page’s view state is persisted to when the page is sent to the browser. When this property is set to true, the encrypted view state is checked to verify that it has not been tampered with on the client.Pavan
MemberHello Nitesh,
This is very useful for posting our sites url on different sites and on forums because they restrict that site url with in specific length.
Below is the code:public static string MakeTinyUrl(string Url) { //pass an url into this function and get the created tinyurl value as output try { string Result = Url; //only process if > 26 else keep same url //reason being tinyurl produces 26 char lengths //so no point if url already <= 26 if (Url.Length > 26) { if (!Url.ToLower().StartsWith("http") && !Url.ToLower().StartsWith("ftp")) { Url = "http://" + Url; } System.Net.WebRequest request = System.Net.HttpWebRequest.Create("http://tinyurl.com/api-create.php?url=" + Url); System.Net.WebResponse res = request.GetResponse(); using (System.IO.StreamReader reader = new System.IO.StreamReader(res.GetResponseStream())) { Result = reader.ReadToEnd(); } } return Result; } catch (Exception ex) { //if any exception just return the original Url seeing this is still valid as an url return Url; } }
I am using in this example a Textbox and button you just type url in Textbox and press submit button then it will display a tiny url just above the Textbox . Simple copy the url and open in web browser.
Like i am using Url:
http://www.authorcode.com/your-first-facebook-windows-application-in-c/Result Tiny Url:
http://tinyurl.com/6oouhqdprotected void Button1_Click1(object sender, EventArgs e) { string Result = MakeTinyUrl(txt_url.Text); Response.Write(Result); }
February 2, 2012 at 12:16 pm in reply to: Encrypt or Decrypt Connection Strings in web.config file using ASP.NET #3436Pavan
MemberHi Nitesh,
Encrypt and Decrypt Connection Strings is very usefully for security point.Like when we are developing a application which secured then connection string Encrypt and Decrypt is one of steps.Define these string at top of page before page load.
string provider = "RSAProtectedConfigurationProvider"; string section = "connectionStrings";
Encrypt connection string code below:
public void Encrypt_connection() { Configuration confg = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath); ConfigurationSection configSect = confg.GetSection(section); if (configSect != null) { configSect.SectionInformation.ProtectSection(provider); confg.Save(); } }
Decrypt connection string code below:
public void Decrypt_connection() { Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath); ConfigurationSection configSect = config.GetSection(section); if (configSect.SectionInformation.IsProtected) { configSect.SectionInformation.UnprotectSection(); config.Save(); } }
Pavan
MemberHello Nitesh,
When we go through page life cycle Render events responsible for display the controls on browser. This event convert server side control into html control.This is event is also part of saving view state on page.
if you want to deep knowledge of page life cycle then go through the author code url:http://www.authorcode.com/asp-net-page-life-cycle/
Below is the code of render event that move the ViewState to the bottom of page.
protected override void Render(System.Web.UI.HtmlTextWriter writer) { System.IO.StringWriter stringWriter = new System.IO.StringWriter(); HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter); base.Render(htmlWriter); string html = stringWriter.ToString(); int StartPoint = html.IndexOf(" < input type=\"hidden\" name=\"__VIEWSTATE\""); if (StartPoint >= 0) { int EndPoint = html.IndexOf("/>", StartPoint) + 2; string viewstateInput = html.Substring(StartPoint, EndPoint - StartPoint); html = html.Remove(StartPoint, EndPoint - StartPoint); int FormEndStart = html.IndexOf("") - 1; if (FormEndStart >= 0) { html = html.Insert(FormEndStart, viewstateInput); } } writer.Write(html); }
January 9, 2012 at 12:25 pm in reply to: What is the difference between a.Equals(b) and a == b? #3336Pavan
MemberHello Ankur,
.Equals and == both used to compare.But internal working of both little bit different.
.Equals work fine reference type and == work fine value type.
Like if we string builder.The StringBuilder is reference type.StringBuilder a = new StringBuilder(“Pavan”);
StringBuilder b= new StringBuilder(“Pavan”);a.Equals(b)–> return true
a==b —> return falseplease let me know if you have any doubt.
January 9, 2012 at 11:31 am in reply to: What is the difference between a Thread and a Process? #3335Pavan
MemberProcess: Is a collection of code,resource or virtual memory space.Process is a program in execution.Thread is subset of process.Each process have at-least have one Thread for execution of Process.Thread have separate path of execution.
A process can have multiple threads. Thread is a Execution instruction. Threads cannot live without a process.
there is two types thread 1: Foreground Thread 2: background Thread.
I will post about thread type and thread containing methods in coming days on Author Code code.January 6, 2012 at 10:51 am in reply to: What is the difference between an Assembly and a DLL? #3309Pavan
Member1:Dll project independent.
2:assembly is project specific.
3:An assembly is a collection of one or more files and one of them DLL or EXE.
4:DLL contains library code to be used by any program running on Windows. A DLL may contain either structured or object oriented libraries.
5:A DLL file can have a nearly infinite possible entry points.
6:Assembly present in bin can have either strong/weak Name and assembly in GAC Should have strong name.
December 15, 2011 at 12:49 pm in reply to: What is the best use of the Using statement in .net #3210Pavan
MemberHello MikeJ,
Using in .Net is just like try catch and finally block. Like when we make connection with sql server then connection should be open in try block and we close the connection in finally block.
But when we used using statement then no need to close the connection when connection object goes out of scope then it dispose connection automatically.
Example 1:
using(SqlConnection cn = new SqlConnection(ConfigurationManager. ConnectionStrings ["MyConnection"].ConnectionString)) using(SqlCommand cmd = cn.CreateCommand()) using(SqlDataAdapter sda = new SqlDataAdapter()) { cn.Open(); /* code that actually does stuff */ } Example 2: Connection c; try { c = new Connection(...); } finally { c.Close(); }
Thanks
pavanPavan
MemberThe System.Reflection.Emit namespace contains classes that allow a compiler or tool to emit metadata and Microsoft intermediate language (MSIL) and optionally generate a PE file on disk. The primary clients of these classes are script engines and compilers.
Define lightweight global methods at run time, using the DynamicMethod class, and execute them using delegates.
Define assemblies at run time and then run them and/or save them to disk.
Define modules in new assemblies at run time and then run and/or save them to disk.
Define types in modules at run time, create instances of these types, and invoke their methods.
Define symbolic information for defined modules that can be used by tools such as debuggers and code profilers.Pavan
MemberHello Ankur,
can you tell me about the advantage of .net framework.Thanks
pavanNovember 28, 2011 at 9:46 am in reply to: save listview data to same excel file but different sheet #3154Pavan
MemberHello All,
I am looking for such type of code from last few days.but finally I found solution form authorcode. Thanks for providing solution.pavan
Pavan
MemberThank you shobhit It help me a lot.
can you tell me how can i know in which condition we use Abstract Class and in which condition we use Interface.Pavan
MemberHello Ankur,
Thanks for your reply.
We can’t delete records from view which is created by more than one table.its show you a error message like this :-Msg 4405, Level 16, State 1, Line 1
View or function ‘multipletable’ is not updatable because the modification affects multiple base tables.Pavan
MemberHello Ankur,
i am trying to explain you delete operation on view by example.Like we have a table test have colums name(ID,NAME,SALARY) and now insert some test data into table.Now time to create view Test_view on table test.
create view Test_view as select * from Test
Now time to fire delete query on view.
delete from Test_view where Id=”It’s time to check the records view and table both.then you will see the deleted record from view also deleted from table.
- AuthorPosts