|
Hello,
I am doing my thesis on Windows Azure and I d like someone to show me how to store data in Windows Azure Tables and then how to publish on Azure Services Development Portal.
I would be glad if someone could send me a working example to take some ideas.
Some examples from msdn that I 've downloaded don't run on my computer and I don't know what is wrong.
Any help would be appreciated...
|
|
|
|
|
hi,
in my project we are using asp.net 2.0 GridView in so many places. Through out the project we are using GridView derived control.
public class GridView : System.Web.UI.WebControls.GridView
{
}
i have added code to maintain seleced checkboxes state, DataKey value ID of selected rows if user selects multiple rows from multiple pages navigation. i am storing the 1) ID, 2) Selected in the ViewState in the form of List.
For this i have 2 methods
StoreCurrentViewState()
RestorePastViewState
this code i have used at...
protected override void OnPageIndexChanging(GridViewPageEventArgs e)
{
StoreCurrentViewState();
base.OnPageIndexChanging(e);
RestorePastViewState();
}
also added at
protected override void OnDataBinding(EventArgs e)
{
StoreCurrentViewState();
base.OnDataBinding(e);
}
protected override void OnDataBound(EventArgs e)
{
base.OnDataBound(e);
RestorePastViewState();
}
it is maintaining selected checkboxes states during the gridview page naigation.
my query is ...
in one aspx page i have 4 grids and for all page it is storing in single ViewState object. i wanted to store these values in sepearate viewstate for each gridview && i need to reset the ViewState object if gridview loads first time. How can i do?
please provide ur inputs...
Ramana
|
|
|
|
|
Use ID or UniqueID of GridViews as the key when storing to ViewState. As each ID is going to be unique in a page, they will be maintained separately for each GriView in ViewState object.
|
|
|
|
|
store the viewstate as GridviewID$ID
and then split it on restoring.
|
|
|
|
|
hi
i am using Application Object to count the number of users created for a webpage.I am using following code in C#:
1. protected void Session_Start(object sender, EventArgs e)
2. {
3. int userCount=(int)(Application["userCount"]) ;
4. Application["userCount"] = ++userCount;
5. }
It gives error @ line 3 saying Object reference not set to an instance of an object. in WebPage.
how do i increment Application Object Value in Session_Start?
i tried
Application["userCount"] + =1 but it says Can't convert Int to Object type....
I am using VS 2008 /ASP.NET 3.5
thanx in advance..
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
Does your Application["userCount"] item exist the first time this code has run? Your code doesn't handle the possibility of it not being there.
|
|
|
|
|
i thought Application object is global object and therefore it exists/initialized by default.....thanx for help..i'll check on the web
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
As indeed it is. However your item in the Application may not have been added, so it will not exist.
|
|
|
|
|
QuickDeveloper wrote: 1. protected void Session_Start(object sender, EventArgs e)
2. {
3. int userCount=(int)(Application["userCount"]) ;
4. Application["userCount"] = ++userCount;
5. }
It is always better to use Application.Lock() and Application.Unlock() before any kind of operation with Application Variable. Because ASP.NET is multithreaded and when multiple users accessing the web site at the same it is required to synchronized the data
void Session_Start(object sender, EventArgs e)
{
if (Application["userCount"] != null) {
Application.Lock();
int visitorCount = (int)Application["userCount"];
Application["userCount"] = userCount++;
Application.UnLock();
}
}
|
|
|
|
|
Check before you call Application object placed in the variable:
if (Application.AllKeys.Contains<string>("userCount"))
{
Application.Lock();
int item = Convert.ToInt32(Application["userCount"]);
Application["userCount"] = item + 1;
Application.UnLock();
}
else
{
Application.Set("userCount", 1);
}
|
|
|
|
|
Abhishek Sur wrote: if (Application.AllKeys.Contains("userCount"))
thanx Abhishek..it really works!!!
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
Hi,
I am using the following code in my Web application for checking whether the image at the remote server exist or not. This works perfectly on my local machine, but when I upload this code on my Live website, it returns no response( response = null)
private static bool IsImageExists(string imageURL)
{
bool fileExist;
HttpWebResponse response = null;
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(imageURL);
request.Method = "HEAD";
request.Credentials = System.Net.CredentialCache.DefaultCredentials;
using (response = (HttpWebResponse)request.GetResponse())
{
if (response.StatusCode == HttpStatusCode.OK)
{
// If no exception was thrown until now, the file exists and we are allowed to read it.
fileExist = true;
}
else
{
// Some other HTTP response - probably not good.
// Check its StatusCode and handle it.
fileExist = false;
}
}
}
catch
{
fileExist = false;
}
return fileExist;
}
Is this threading related issue. Please give me quick solution.
Thanks in Advance.
d'kng
|
|
|
|
|
Not getting any error? Looks like your server may be using proxy. Try setting the proxy details to the request object.
|
|
|
|
|
Thanks Navneet,
I am updating the code with this additional lines to set proxy.
WebProxy browserProxy = new WebProxy();
// Obtain the Proxy Prperty of the Default browser.
browserProxy = (WebProxy)request.Proxy;
request.Proxy = browserProxy;
I'll update you once it is done.
D'kng
|
|
|
|
|
Hey Guys need help
I created a DataSet with the query that i need. However i will like to display the DataSet Detail to the crystal Report
DataSet ds = DBCall.ReturnDataSet(SQL , DBCall.ITSDatabase);
CrystalReportViewer1.DisplayGroupTree = false;
CrystalReportViewer1.HasCrystalLogo = false;
ReportDocument myReportDocument;
myReportDocument = new ReportDocument();
myReportDocument.Load(Server.MapPath("CrystalReport2.rpt"));
myReportDocument.SetDataSource(ds);
CrystalReportViewer1.ReportSource = myReportDocument;
CrystalReportViewer1.DataBind();
However i can't seem to display it one the report. I know this is the Push Method however
I need to set the layout of the report right? How am i suppose to set it ?
Many thanks
KaKaShi HaTaKe
|
|
|
|
|
Hi
I'm trying to play audio on my webpage directly from the databse, can anyone help me with the code for my method: playAudio(byte[] stream), please see my code bellow.
thanks n advance
<pre>string sql = @"Select AudioFile from tbDeviceResults where DialResultID = @ID";<br />
SqlConnection oCon = new SqlConnection(DatabaseConnection.ConnectionString);<br />
SqlCommand cmd = new SqlCommand(sql, oCon);<br />
cmd.CommandType = CommandType.Text;<br />
cmd.Parameters.AddWithValue("@ID", ID);<br />
DataTable tblData = new DataTable();<br />
try<br />
{<br />
new SqlDataAdapter(cmd).Fill(tblData);<br />
foreach (DataRow row in tblData.Rows)<br />
{<br />
stream = (byte[])row["AudioFile"];<br />
playAudio(stream);<br />
}<br />
}<br />
catch (Exception ex)<br />
{<br />
<br />
<br />
}<br />
void playAudio(byte[] stream)<br />
{<br />
<br />
}<br />
<br />
</pre>
|
|
|
|
|
DotNetCoderJunior wrote: can anyone help me with the code for my method: playAudio(byte[] stream),
You will need to make an ASP.NET page which reads the content as you arealy did and set the appropriate MIME type using ContentType
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi all,
following code is using to send mail.
Problem is,it is reaching only our company domain mail ids not others.like gmail,yahoo etc which is wrong.
what i have to do to send any mail id from any my gmail or company mail id.
please can anybody give me some solution.pleaseee
Dim objmail
objmail = New MailMessage
With objmail
.To = "abcd@ourcomanydomain.in"
.From = "abc@yahoo.co.in"
.Cc = "abc@ourcompanydomain.in"
.Subject = "My Message"
.Body = "HTML Messag"
.BodyFormat = MailFormat.Html
End With
SmtpMail.SmtpServer = "localhost"
SmtpMail.Send(objmail)
kissy
|
|
|
|
|
Once you have sent any mail at all, then you are able to send mail. Any mail that gets lost, is probably getting caught in a spam filter.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
thanks for ur replay.when i can send to my company domain,then how the spam can filter other mails.
i am not getting,can u please give me some explanation with some example so that i can apply in my code?/
unsent msgs are queued up in queue folder of inetpub
please
kissy
|
|
|
|
|
This is probably an SMTP relaying issue which goes beyond the scope of ASP.Net
Talk to your network administrator and tell him that your server needs to be permitted to relay messages.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Kissy16 wrote: following code is using to send mail.
Problem is,it is reaching only our company domain mail ids not others.like gmail,yahoo etc which is wrong.
The code is ok and you can do nothing in your code to allow this.
You should check your smtp server whether it actually sends the mail outside your company domain or not?
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
thanks for ur reply.
how to check this?what i have to at smtp end?
coz i hae keep it on hosting server.accordign that can u give me some idea???
please
kissy
|
|
|
|
|
Talk to your network admin. If mail is only running to your internal address, then the mail server needs to be configured to allow outside mail. Or you should use a different server
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
8.
class a
{
public virtual void a()
{
cwl ("Base");
}
}
class b : a
public overrides void a()
{
cwl ("Dericed");
}
}
b obj=new b();
b.a();
what is the outpu?
9. Difference between Private constructor and Sington class?
10. What are Generics? Example on that?
11. Difference between SP and UDF?
12. Can we call UDF from .NET like Stored Procedure?
13. Difference between public and protected Internal?
14. what are all the methods of System.Object?
15. Difference between Finalize() and Dispose?
16. Destructor?
|
|
|
|