|
|
Hi sheemap,
Hiren Solanki wrote: See HERE[^] for more.
What Hiren said is absolutely true.
BTW if you go through that link, you can learn how to configure connections string with different databases, data files ..etc.
Happy Coding...
|
|
|
|
|
|
Dear Ravi,
Matter here is not about storing a connection string in a safe place.
Please get into the question properly.
|
|
|
|
|
Hiren Solanki wrote: Please get into the question properly.
Of-course I did it before posting my answer.
Hiren Solanki wrote: Matter here is not about storing a connection string in a safe place.
He just want to know how to create a connection for Web programming and I just referring him Links with valuable advice whatever, thanks for your advice.
|
|
|
|
|
Dear Friends,
I want to open a file on the click of a link in the Grid named as VIEW. The path I am binding to is the local path i.e., ~/Documents/ScanDoc/[FileName] but when i am opening it on the local server; I am getting the error as follows:-
File does not exist.
System.Web.HttpException: File does not exist. at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response) at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context) at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
But when I updated the PathColumn in database with this value:-"http://localhost:1383/~/Document/ScanDoc/[FileName]" which is actually being saved as "Documents/ScanDoc/[FileName]", the thing worked and i was able to see the file when i clicked on the link.
Now my problem is that how could i bind "http://localhost:1383/~" path to "Documents/ScanDoc/[FileName]" which is being saved in the database.
Thanks
Varun Sareen (Dot Net Developer)
|
|
|
|
|
Just grab the Url Authority like
String UrlAuthority = String.Format("http://{0}",Request.Url.Authority);
Now make a string of your static path
String Path = "Documents/ScanDoc/[FileName]";
Combine both for final Output
String FullPath = Path.Combine(UrlAuthority,Path);
And you're done.
|
|
|
|
|
Thanks Hiren, the thing you told worked
Varun Sareen (Dot Net Developer)
|
|
|
|
|
Glad it helped you.
You can always rate Answer if it helped you.
|
|
|
|
|
Following code does not handle columns that start with +. for example,
'+923339933886' is not rendered well(some kind of charmap characters shown).
HtmlForm form = new HtmlForm();
string attachment = "attachment; filename=Employee.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
StringWriter stw = new StringWriter();
HtmlTextWriter htextw = new HtmlTextWriter(stw);
form.Controls.Add(gvEmployee);
this.Controls.Add(form);
form.RenderControl(htextw);
Response.Write(stw.ToString());
Response.End();
Please let me know what is the changes required in this code.
|
|
|
|
|
Are you sure you will get a better response this time then That[^]?
|
|
|
|
|
Check my answer here[^] for your question.
BTW please wait for the replies don't post duplicate questions. cheers.
|
|
|
|
|
Hi All,
I've got the following lines in my button click handler.
if (!this.CheckObjectivesCheckBoxesValid())
{
var repeaterValidator = new CustomValidator();
repeaterValidator.IsValid = false;
repeaterValidator.ErrorMessage = "Please select at least one objective.";
Page.Validators.Add(repeaterValidator);
}
if (string.IsNullOrEmpty(this.txtDetails.Text) && string.IsNullOrEmpty(this.txtSuggestions.Text) && string.IsNullOrEmpty(this.txtSupportingEvidence.Text))
{
var requiredFields = new CustomValidator();
requiredFields.IsValid = false;
requiredFields.ErrorMessage = "You must include information in at least one of Details, Suggestions or Evidence";
Page.Validators.Add(requiredFields);
}
But the validation never seems to happen ...
Any ideas?
|
|
|
|
|
I tested your code and It's passing through IF and later adding to Validators it doesn't seem to display an Error Message.
You can have a Look to This CP Article[^]
|
|
|
|
|
Exactly what I thought.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Oh sorry, But you're 1.59 hrs late.
|
|
|
|
|
I'm always late... It's what happens when you live in a far western time zone.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Hi
I am having great issues trying to debug a page on a web application used internally on an intranet. When entering the page the "Security Information" Pop Up Box appears. The whole application is running under https.
To try and debug the issue, I have used Fiddler, and looked at the urls for every component, javascript, css, images, and user control components. Everything I have seen from Fiddler shows that the urls start with required https!
So, I am completely confused why this message should be shown - it appears everything the page is posted back.
Does anyone have any idea why this should be happening and/or have another tool that could help me?
Thanks
|
|
|
|
|
Try to check with firebug on the net, whether all the requests are going through SSL only.
|
|
|
|
|
We have checked with Fiddler that each request is https
|
|
|
|
|
hi
i have sql-server-2008 database that contain image field that hold picture.
i have pictureBox control in my webform.
how to put picture from database to pictureBox control ?
(i work with C# asp.net FW3.5)
can i get any sample code or program ?
thanks
|
|
|
|
|
|
please first search , if you dont result tell youre question
|
|
|
|
|
i have this code to insert picture from database to image control:
string strQuery = "select Pic from MEN where id='1'";
SqlCommand cmd = new SqlCommand(strQuery);
Convert.ToInt32(Request.QueryString["ImageID"]);
cmd.Parameters.Add("1", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["ImageID"]);
DataTable dt = GetData(cmd);
if (dt != null)
{
Byte[] bytes = (Byte[])dt.Rows[0]["Pic"];
Response.Buffer = true;
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = dt.Rows[0]["PIC"].ToString();
Response.AddHeader("content-disposition", "attachment;filename=" + dt.Rows[0]["PIC"].ToString());
Response.BinaryWrite(bytes);
Response.Flush();
Response.End();
}
and this:
private DataTable GetData(SqlCommand cmd)
{
DataTable dt = new DataTable();
String strConnString = "server=" + Server + ";database=" + DataBase + ";UID=" + UID + ";password=" + PASS + ";";
SqlConnection con = new SqlConnection(strConnString);
SqlDataAdapter sda = new SqlDataAdapter();
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
try
{
con.Open();
sda.SelectCommand = cmd;
sda.Fill(dt);
return dt;
}
catch
{
return null;
}
finally
{
con.Close();
sda.Dispose();
con.Dispose();
}
}
and this image:
<asp:image ID="Image2" runat="server" ImageUrl ="PhoneBook.aspx?ImageID=1"/>
but when I run this code I get "save picture on disk" and not insert to the image control
How to fix it ?
thanks
|
|
|
|
|
Would be a good answer if weren't already given 15 hours ago.
I know the language. I've read a book. - _Madmatt
|
|
|
|