|
Could you not just create a class that has a redirect method - this method will retrieve whatever you defualt values are from whereever you are storing them and then call a response.redirect.
Then instead of calling response.redirect from your code you just call aClass.Redirect or something like that. Bit simpler than creating a Http module.
|
|
|
|
|
If I do a response.redirect I lose any form values that may have been posted. I preferably don't want to even have to enter a URL as navigateURL=ChangeURL(URL), I'd rather have it happen automatically in case I forget.
|
|
|
|
|
|
hi,
how to move a folder and folder contents (only files) from one location to another specified location .
kamalnath
|
|
|
|
|
hi, how to create a folderBrowser in ASP.net
kamalnath
|
|
|
|
|
Client folders or server folders? To do what?
|
|
|
|
|
I am using .NET 2.0 C#. How can I check what time the user log in. And greet the user "Good Morning, name" etc. Do I need to set the time for morning, afternoon and evening? Or .NET has its property set.
Example:
Morning 12am-11.59am
Afternoon 12pm-4pm
etc
thanks in advance. Much appreciated.
|
|
|
|
|
Dont think thers any specific function that will do it. Alternatively you could just get the DateTime.Now.Hour and use a condition
|
|
|
|
|
Thanks. I did a if else.
thanks in advance. Much appreciated.
|
|
|
|
|
Hey folks, any help on this would be great. I'm trying to create an online RSS Reader and I've run into a snag. Following is the code that I've got that's erroring out. The line that is erroring out is " lstSubscriptions_SelectedIndexChanged(Nothing, Nothing)"
And thanks again in advance for any help.
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
btnSubscribe.Enabled = False
'---When the form loads for the first time ---'
Dim FeedNames() As String = Profile.FeedNames.Split(";")
Dim FeedURLs() As String = Profile.FeedURLs.Split(";")
'---Populate the ListBox control---'
For i As Integer = 0 To FeedNames.Length - 2
Dim listItem As New ListItem(FeedNames(i), FeedURLs(i))
lstSubscriptions.Items.Add(listItem)
Next
'---Select the first item in the List Box ---'
If lstSubscriptions.Items.Count > 0 Then
lstSubscriptions.SelectedIndex = 0
lstSubscriptions_SelectedIndexChanged(Nothing, Nothing)
End If
End If
End Sub
Protected Sub btnVerifyFeed_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnVerifyFeed.Click
'---Load the RSS feed XML document and extract the title ---'
txtFeedTitle.Text = LoadFeed(txtRssURL.Text)
If txtFeedTitle.Text = String.Empty Then
DisplayError("Feed did not load correctly.")
Else
btnSubscribe.Enabled = True
End If
End Sub
End Class
Protected Sub DisplayError(ByVal msg As String)
'---Display a Window on the client side ---'
Dim script As String = "alert('" & msg & "');"
Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "Key", script, True)
End Sub
Public Function LoadFeed(ByVal URI As String) As String
Dim req As HttpWebRequest
Dim xmlDoc As XmlDocument = Nothing
Try
req = SendRequest(URI, "GET")
Dim xmlData As String = GetResponse(req)
xmlDoc = New XmlDocument()
xmlDoc.LoadXml(xmlData)
'---Select the title of the document---'
Dim titleNode As XmlNode = xmlDoc.DocumentElement.SelectSingleNode("channel/title")
Return titleNode.InnerText
Catch ex As Exception
Return String.Empty
End Try
End Function
Public Function SendRequest(ByVal URI As String, ByVal requestType As String) As HttpWebRequest
Dim req As HttpWebRequest = Nothing
Try
'---Creates a HTTP request ---'
req = HttpWebRequest.create(URI)
req.Method = requestType '---Get or POST---'
Catch ex As Exception
Throw New Exception("Error")
End Try
End Function
Public Function GetResponse(ByVal req As HttpWebRequest) As String
Dim body As String = String.Empty
Try
'---Get a responce from server---'
Dim resp As HttpWebResponse = req.GetResponse()
Dim Stream As Stream = resp.GetResponseStream()
'---Use a StreamReader to read the response---'
Dim reader As StreamReader = New StreamReader(stream, Encoding, UTF8)
body = reader.ReadToEnd()
stream.Close()
Catch ex As Exception
Throw New Exception("Error")
End Try
Return body
End Function
Protected Sub lstSubscription_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstSubscriptions.SelectedIndexChanged
Try
'---Bind the XmlDataSource control to the selected item URL---'
XmlDataSource1.DataFile = lstSubscriptions.SelectedItem.Value
Catch ex As Exception
DisplayError("Error displaying the feed.")
End Try
End Sub
Protected Sub btnSubscribe_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubscribe.Click
'---If user did not enter an URL ---'
If txtRssURL.Text = String.Empty Then
DisplayError("Please enter the feed URL.")
Exit Sub
End If
'---Bind the XmlDataSource Control to the URL Specified---'
XmlDataSource1.DataFile = txtRssURL.Text
'---Add tot he ListBox Control---'
Dim listItem As New ListItem(Trim(txtFeedTitle.Text), Trim(txtRssURL.Text))
'---If no duplicate entry in the ListBox---'
If Not lstSubscriptions.Items.Contains(listItem) Then
lstSubscriptions.Items.Add(listItem)
lstSubscriptions.SelectedIndex = lstSubscriptions.Items.Count - 1
'---Add to the Profile properties---'
Profile.FeedNames += Trim(txtFeedTitle.Text) & ";"
Profile.FeedURLs += Trim(txtRssURL.Text) & ";"
Else
DisplayError("Feed is already subscribed.")
End If
btnSubscribe.Enabled = False
End Sub
Protected Sub btnUnsubscribe_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUnsubscribe.Click
Try
'---Remove the unsubsribed URL from the Profile properties---'
Profiles.FeedNames = Profile.FeedNames.Remove(Profile.FeedNames.IndexOf(lstSubscriptions.SelectedItem.Text), lstSubscriptions.SelectedItem.Text.Length + 1)
Profiles.FeedURLs = Profile.FeedURLs.Remove(Profiles.FeedURLs.IndexOf(lstSubscriptions.SelectedItem.Value), lstSubscriptions.SelectedItem.Value.Length + 1)
'---Remove the item from the ListBox Control---'
lstSubscriptions.Items.Remove(lstSubscriptions.SelectedItem)
'---Select the first item in the ListBox---'
If lstSubscriptions.Items.Count > 0 Then
lstSubscriptions.SelectedIndex = 0
lstSubscriptionis_SelectedIndexChanged(Nothing, Nothing)
Else
'---ListBox is Empty; bind to the Defualt RSS---'
XmlDataSource1.DataFile = "-/RSS.xml"
DataList1.DataBind()
End If
Catch ex As Exception
End Try
End Sub
-- modified at 2:28 Monday 24th July, 2006
|
|
|
|
|
Rob Howard wrote: lstSubscriptions_SelectedIndexChanged(Nothing, Nothing)
...Protected Sub lstSubscription_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)...
I guess you can figure out the cause !
no s at the end of Subscription
|
|
|
|
|
Dear Friends,
How can i change Formview's DefaultMode programatically........
in ASP.NET 2.0
Please help me....
Haridas.R
harisofttech@hotmail.com
"Achievement is not a destination, its a journey "
|
|
|
|
|
Something looks like:
FormView1.DefaultMode = FormViewMode.Insert; Also, you might want to check out the ChangeMode method to change the current mode of the control.
|
|
|
|
|
Thank yo for the Information
Haridas.R
harisofttech@hotmail.com
"Achievement is not a destination, its a journey "
|
|
|
|
|
Hi,
How to compare start date is greater than End Date in Java Script
Example.
Startdate= “6-Jan-2006”
EndDate =”2-December-2005”
Any Help is appreciated.
Regards,
Rajesh
rajesh
|
|
|
|
|
var myDate=new Date()
myDate.setFullYear(2010,0,14)
var today = new Date()
if (myDate>today)
alert("Today is before 14th January 2010")
else
alert("Today is after 14th January 2010")
try like this
with regards,
susa
|
|
|
|
|
|
|
Hi,
Anybody have some guideline for me to learn more about ASP.net? i am a fresh and i so interest to learn about it...Please give me some url, thank you for your help.
Best regards,
Chee ken
|
|
|
|
|
Me also interested learn more about asp.net.
Best Regards,
Pei Sun
|
|
|
|
|
|
I was trying out this code. But .NET 2.0 display syntax error. How do I correct it?
<code>
/// <summary>
/// Gets the link text that appears in the column headers
/// </summary>
/// <param name="i">original column number</param>
/// <param name="field">column field name</param>
/// <returns>Header Text</returns>
public string GetHeaderText(int i, string field)
{
string remove = (ListStart.IndexOf(i.ToString() + ":") > -1)
? " <a href=\""multisort.aspx?c="+i+"&x=r&ls="+ListStart+""\">x</a>" : string.Empty;
return "<a href=\""multisort.aspx?c="+i+"&d="+GetDirection(i)+"&ls="+ListStart+""\">"+field+"</a>" + remove;
} </code>
syntax error of invalid expression term : and ; expected.
thanks in advance. Much appreciated.
|
|
|
|
|
Try to fix the escape sequences in code to concate strings properly, for example you might want \" instead of \""
|
|
|
|
|
wow. thanks.
thanks in advance. Much appreciated.
|
|
|
|
|
I have string = $a abc $b cde $& $a def $b ikm $& $a fgh $b htt $&
i use method Split() get a arrary Seperate by "$&" but not unsussetful beacuse method Split() have prameter is char
some body help me
|
|
|
|