i am new to web development and i am learning Asp.net. i was the other day thinking and i came up with this question. i searched the web but all the answers i found were old so my question is , can silverlight4 replace Asp.net? I know this question sounds crazy . but let's think for moment we use ASP.net to talk to a server.to Create files there ,to talk to a database etc. SilverLight can do the same thing ,right? OK,you might say that if I built a web site using SilverLight then not all users out there can access it. but apparently SilverLight supports IE,FireFox Safari and googleChrome so i guess this isn't an issue anymore. so what do you think ,can silverlight replace asp.net?
AJAX is the big thing...but it seems (to me) that with Silverlight 4 Microsoft has offered a really robust method for creating UI interfaces for the web. I'm wondering - what is the future of AJAX? Do AJAX and Silverlight complement each other or will Silverlight replace AJAX, etc.?
I need to replace <span> entries in a string to legacy html code because it's going to be used in a report for Crystal Reports. <b> works with Crystal, but the<span>'s do not.
Here's the string which I'm trying to replace: <span style="font-weight: bold">%THIS CAN BE ANY TEXT%</span>. I want to replace it to
i have done dynamic row create using asp:table control..but the problem is when add another row its not generate new row that replace only old row..whenever i count the tr again its take the count zero..here i want no. of row when user done each button click..
I need a regex or any other solution to replace an id in the middle of a url (not in querystring). url example - http://localhost:1876/category/6?sortBy=asc&orderBy=Popular
replace - category/6 with category/anotherID - routing used - routes.MapRoute( "categories", "category/{categoryID}/{categoryName}", new { controller = "Search", action = "SearchResults", categoryID = "", categoryName = "" } );
I was wondering what the best way is to replace the genericPrincipal with my own CustomGenericPrincipal. At the moment I have something like this but I aint sure if it's correct.
protected void Application_AuthenticateRequest(Object sender, EventArgs e) { HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie != null) { FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value); var identity = new CustomIdentity(authTicket); var principal = new CustomPrincipal(identity); Context.User = principal; } else { //Todo: check if this is correct var genericIdentity = new CustomGenericIdentity(); Context.User = new CustomPrincipal(genericIdentity); } }
I need to replace it because I need a Principal that implements my ICustomPrincipal interface because I am doing the following with Ninject:
i am creating CMS and display the content of every page on a single page when i/user click on any URL the pageid is transferd through query string variable on default.aspx page and content is displayed in div, when value is transfered to default.aspx page the url is like this example [URL] now i want to change it like this................
I am receiving the contents of a file via ftp. I don't want to go into every detail (unless needed), but I am working with existing code that was using 3rd-party software to get ftp files. I am replacing that with .NET code. But I want to replace as little as possible of the existing code that is not specifically using the 3rd-party s/w. So I am trying to use a class originally written by the author of the code (a former employee).
This is his class constructor:
Code:
Public Sub New(ByVal fileName As String, ByVal content As StreamReader) Me.FileName = fileName Me.Content = content Me.TimeStamp = Date.Now End Sub
So I need to pass a StreamReader. My problem is how to get one. In my procedure ReceiveFile(), I execute this code:
Code:
Private Shared Sub ReceiveFile(ByVal sFilename As String, ByRef objMemoryStream As System.IO.MemoryStream) Try
Dim request As FtpWebRequest = DirectCast(WebRequest.Create("ftp site and folder" & sFilename), FtpWebRequest) request.Method = WebRequestMethods.Ftp.DownloadFile request.Credentials = New NetworkCredential("id", "pw") Dim response As FtpWebResponse = DirectCast(request.GetResponse(), FtpWebResponse) Dim responseStream As Stream = response.GetResponseStream() Dim reader As New StreamReader(responseStream) Dim sFile As String = reader.ReadToEnd 'reader.Close() ' response.Close() 'objMemoryStream = responseStream Dim objStream As System.IO.MemoryStream objStream = New System.IO.MemoryStream(Convert.FromBase64String(sFile)) ' objMemoryStream = Convert.FromBase64String(sFile) objMemoryStream = objStream 'Return reader Catch ex As Exception Dim i As Integer i = 10 End Try End Sub
responseStream is declared as a stream but when I query it in the debugger it says it's an FtpDataStream, after it's set equal to response.GetResponseStream. I want to take that stream and somehow get it into a MemoryStream. I thought I found the solution this morning via Convert.FromBase64String, but when I ran I got an exception saying "Invalid character in a base-64 string", and I think it's because of the newline character in the string. The file that's received contains three lines separated by a newline character.
I just wanted to hear some authorities on when and where you should use a LITERAL control over a LABEL. As I understand it, the difference is this: A LABEL can be styled via the <SPAN> tags that are added.
I personally find the addition of <SPAN> tags in my HTML to be very annoying and never actually apply styles through ASP, and so LITERALs seem to be what should be used most of the time... but I'm concerned there's other considerations or benefits to using a LABEL over it that I'm unaware of.
Is it 100% completely fine to replace any LABELs with LITERALs, provided we're not applying styles to them? Are there NO other considerations?
with a regex that would replace the following. The only thing that would remain the same is the div tags, the id's and classes could change and so could the content.
<div id="nav" class="whatever">Content is whatever</div>
The code works, but I need to include some exceptions to the replace - e.g. I will not replace anything i an img-, li- and a-tag (including link-text and attributes like href and title) but still allow replacements in p-, td- and div-tags.
How do I solve the problem below? I'm creating a simple content management system, where there is a HTML template with specific markup that denotes where content should be:
Separate from this, there is content in a database field that looks a little like this:
<!-- #BeginEditable "Body1" -->This is Test Text<!-- #EndEditable --><!-- #BeginEditable "Extra" -->This is more test text<!-- #EndEditable -->
As you can guess I need to merge the two, that is, replacing
<!-- #Editable "Body1" -->
with: This is Test Text. I've begun the code here. But I'm having problems using the Regex Replace function that should be located at the very bottom of that For/Each.
//Html Template string html = "<html><head></head><body><!-- #Editable "Body1" --><p>etc etc</p><!-- #Editable "Extra" --></body></html>"; //Regions that need to be put in the Html Template string regions = "<!-- #BeginEditable "Body1" -->This is Test Text<!-- #EndEditable --><!-- #BeginEditable "Extra" -->This is more test #EndEditable -->"; //Create a Regex to only extract what's between the 'Body' tag Regex oRegex = new Regex("<body.*?>(.*?)</body>", RegexOptions.Multiline); //Get only the 'Body' of the html template string body = oRegex.Match(html).Groups[1].Value.ToString(); // Regex to find sections inside the 'Body' that need replacing with what's in the string 'regions' Regex oRegex1 = new Regex("<!-- #Editable "(.*?)"[^>]*>",RegexOptions.Multiline); MatchCollection matches = oRegex1.Matches(body); // Locate section titles i.e. Body1, Extra foreach (Match match in matches) { string title = oRegex1.Match(match.ToString()).Groups[1].ToString(); Regex oRegex2 = new Regex("<!-- #BeginEditable "" + title + ""[^>]*>(.*?)<!-- #EndEditable [^>]*>", RegexOptions.Multiline); // // // Replace the 'Body' sections with whats in the 'regions' string cross referencing the titles i.e. Body1, Extra // // // }
I have a page, which is called from 2 different functions. For each function, the page has to be display different image. I have 2 images. On the aspx page, code is like this. Please help me out how to display different image for different functions!
i need one query replace all in table.. example of one table have null value replace in "000" .. but null value not only in single column .. it is present in more column.. i need single query... below query only for replace in single column...."SELECT REPLACE(salary, 'null', '000')as new from salary"
I'm trying to import an xml file into vb.net XmlDocument but am getting the error:hexadecimal value 0x00, is an invalid character. Line 94, position 1.I'm wondering if there is a way to replace the hex character 0x00he following are lines 92,93,94 the file ends on line 94 the file.
Dim fs As FileStream = File.Open(FileName, FileMode.Open, FileAccess.Read) Dim buffer(fs.Length) As Byte fs.Read(buffer, 0, fs.Length) Dim xmlString As String = System.Text.UTF8Encoding.UTF8.GetString(buffer) fs.close()