|
ohk thanks for the reply but i have checked it ...n configuration is done perfectly ...anyway will go through firewall settings
|
|
|
|
|
one more doubt when m accessing my application using fixed ip adddress then i should type in browser as follwow
fixed ip adrees//ip address of host machine??
when i did so then got follwing message in
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
since i have installed iis in my host machine in this way if i access my application with above entry then it should show me iis page not the 404 instead?...please correct me if i am wrong....n do help me with solutions.
Thanks
|
|
|
|
|
For your site to be accessible via just the IP the site has to be mapped accordingly so that all requests for the IP go to your site (or all requests in general by leaving the "hostname" empty in the bindings). At the end of the day your site is wrongly configured, we can't access your IIS settings, we don't know how you've set it up. I'd spend some time learning how you configure sites and how IIS works, as just repeatedly saying that your site doesn't work is like phoning a mechanic and saying "My car doesn't work, what's wrong?"
|
|
|
|
|
i have already configured my host machine ip address to my router with which host machine is connected with ...hence i just need to type a publice ip address on the browser of remote machine and ip addres of host machine like below
public ip address//host machine ip address configured to the router
in this way once i type above in remote machine my iis page should be displayed ....but its giving error that serever not found....which is not the case when i am doing the same in LAN ....infact my app is working fine....only while making it work over WAN m getting the issues....please let me know where i am going wrong
Thanks
|
|
|
|
|
That is, I don't want to instantiate a second form (or third or forth..) when I click a new row. I want the form already there, say form2, to show the data row from form1.
form1 has the gridview. Click one line and the textboxes on form 2 populate with the new row selected.
Is this possible?
Thanks!
|
|
|
|
|
I am following this tutorial: http://www.w3schools.com/aspnet/mvc_models.asp, to get data from SQL CE using Entity Framework. There doesn't seem to be much code. The tutorial is for MVC3 but my project is MVC4, but I think major steps should be same.
I created a SQL CE database, and a table with needed columns.
Added data to the table.
On the C# side I have
namespace MvcDemoApp.Models
{
public class Employee
{
public int EmployeeID { get; set; }
public string Name { get; set; }
public string Gender { get; set; }
public string City { get; set; }
}
public class EmployeeContext : DbContext
{
public DbSet<Employee> employees { get; set; }
}
}
And code in respective controller
public ActionResult Index()
{
var c = db.employees.ToList();
return View(c);
}
That sample is for movies database, I changed all relevant info to employees.
I added the connection string as in that tutorial too.
But when I navigate to the Index page of above controller, the empty list is returned. What did I miss?
It seems I gave correct meaning to table columns too (e.g. similar to Employee class properties)
PS. This is how the DB looks after I stop running the app
image
|
|
|
|
|
protected void btn_dwn_Click(object sender, EventArgs e)
{
string File = ListBox1.SelectedValue;
Response.ContentType = ContentType;
Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(File));
Response.End();
}
Now the files are saving in local, downloads folder. I don't want it to happen. I want it to automatically save in c:\ with new folder.....
This is my code...Could anyone help me..
|
|
|
|
|
I believe for security reasons you cannot do this otherwise what's to stop someone pushing a file to a client silently to the client's system folders?
Ergo the client takes over handling where to save it to instead.
|
|
|
|
|
string[] file = null;
int idx;
protected void Page_Load(object sender, EventArgs e)
{
DirectoryInfo dinfo = new DirectoryInfo(@"\\192.168.5.10\fbar\TOOLS\ProbingApps\ProbingSystem\DesktopCopyTemp");
FileInfo[] Files = dinfo.GetFiles("*.txt");
foreach (FileInfo file in Files)
{
ListBox1.Items.Add(file.Name);
}
}
this is the code which shows files directory, and it display on listbox...
Now, I want to download files from list box. I'm not sure with the code. please do help me....Thank You.
|
|
|
|
|
|
Thank You. its really work..
|
|
|
|
|
Hello!
I have created a project intended to get a better understanding of how to create an admin panel for users and seed data. It seems to me that seeding is now working as intended, but the admin panel for users is a bit more complicated than I thought it would be.
Let's start by saying I have already looked at this
tutorial on the topic but I find it's geared to such a different workflow than mine that trying to adapt it without having a firm grasp on the topic would be a lot more work than having something basic working for my own. The main issues I have with that article is that it is entirely based on the idea that users cannot register from the outside(which I instead want) and it is a preparation for another article to manage user groups (that I do not need at the moment).
From Googling, I realised that I need a couple of ViewModels, so I created them:
public class UserViewModel
{
[Required]
[Display(Name = "Email")]
[EmailAddress]
public string Email { get; set; }
[Required]
[Display(Name = "Enabled")]
public Boolean Enabled {get; set; }
[Required]
[Display(Name ="Active")]
public Boolean Active { get; set; }
[Required]
[Display(Name = "Lockout date and time")]
public DateTime? LockoutEndDateUtc { get; set; }
[Required]
[Display(Name ="Lockout enabled")]
public Boolean LockoutEnabled { get; set; }
}
public class UserListViewModel
{
private ICollection<UserViewModel> _UserList = new List<UserViewModel>();
public UserListViewModel( ApplicationDbContext ctx)
{
UserViewModel User;
foreach (var user in ctx.Users)
{
User = new UserViewModel();
User.Email = user.Email;
User.Active = user.Active;
User.Enabled = user.Enabled;
User.LockoutEnabled = user.LockoutEnabled;
User.LockoutEndDateUtc = user.LockoutEndDateUtc;
}
}
Trying to create a controller, however, resulted in VS kicking and screaming that there is no key. Googling again, it appears that VS thinks I am creating new database entities(something that I am not trying to do, promise!!!).
My understanding is that at least part of the reason for this is that I have a dbcontext in the constructor.
I am fairly a newbie in ASP.NET MVC, so I would like you to please show me the error of my ways.
Thanks!
A
|
|
|
|
|
I am working on HandelBar js to load data into Aps.net controls. can we use Ajax controls in handlebar template?
i tried but it is not working for me
<table id="tblPeriodDateRanges" style="overflow: auto">
<thead class="dark_blue_header">
<tr>
<td style="width: 50px;">
<asp:Label runat="server" Text="Edit"></asp:Label></td>
<td style="width:200px;">
<asp:Label runat="server" Text="Standard Season Name"></asp:Label></td>
<td style="width: 200px;">
<asp:Label runat="server" Text="From"></asp:Label></td>
<td style="width: 200px;">
<asp:Label runat="server" Text="To"></asp:Label></td>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<script id="PeriodDateRangeTemplate" type="text/x-handlebars-template"">
{{#each this}}
<tr>
<td>
<asp:HiddenField runat="server" ID="RowID" />
<asp:ImageButton runat="server" ID="btnDelete" ImageUrl="~/App_Themes/Default/images/remove_16x16.png" AlternateText="Remove" OnClientClick="return DeleteRow(this.parentElement.parentElement);" />
</td>
<td>
<asp:HiddenField runat="server" ID="hdnSeasonID" Value="{{this.SeasonTypeID}}" />
<asp:TextBox runat="server" ReadOnly="true" ID="txtSeasonName" value="{{this.SeasonTypeName}}" class="readOnlycss txt" />
<asp:DropDownList runat="server" ID="ddlSeasonName" CssClass="class_Season_ddlCP"></asp:DropDownList>
</td>
<td>
<asp:TextBox runat="server" ID="txtFromDate1" Text="{{this.DateRangeStartDate}}" CssClass="txt readOnlycss" />
<cc1:CalendarExtender ID="CalendarExtendertxtFromDate" runat="server" TargetControlID="txtFromDate1"></cc1:CalendarExtender>
</td>
<td>
<asp:TextBox runat="server" ID="txtToDate1" Text="{{this.DateRangeEndDate}}" CssClass="txt readOnlycss" />
<cc1:CalendarExtender ID="CalendarExtendertxtToDate" runat="server" TargetControlID="txtToDate1"></cc1:CalendarExtender>
</td>
</tr>
{{/each}}
</script>
|
|
|
|
|
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
DirectoryInfo dinfo = new DirectoryInfo(@"C:\Users\Probing\Desktop");
FileInfo[] Files = dinfo.GetFiles("*.txt");
foreach (FileInfo file in Files)
{
ListBox1.Items.Add(file.Name);
}
I have the source code but its not displaying anything in the listbox..
can anyone help me why is this so?
|
|
|
|
|
If I understand the question correctly, the problem is that you have placed the code that adds items into the listbox inside a SelectedIndexChanged event handler. So the code will only be run when an item from the list box is selected so if you have no items, the code is never run.
Try moving the code to a place which is executed when the listbox is shown. For example if this is Windows Forms, you can use load event:
public Form1() {
InitializeComponent();
this.Load += Form1_Load;
}
private void Form1_Load(object sender, EventArgs e) {
DirectoryInfo dinfo = new DirectoryInfo(@"C:\Users\Probing\Desktop");
FileInfo[] Files = dinfo.GetFiles("*.txt");
foreach (FileInfo file in Files)
{
ListBox1.Items.Add(file.Name);
}
}
|
|
|
|
|
ya, its worked.
Thank you so much for the kind share.
|
|
|
|
|
I have one more question.
is the files can be download to local from listbox?
I have looked for it but I did not get any source code for it.
|
|
|
|
|
I'm sorry but I don't quite understand the question.
Also this seems to be a separate issue, so I suggest posting a new question with relevant details.
|
|
|
|
|
|
So I have a Webforms Web Project. I have these backend master pages that I'm converting to bootstrap.css, and I thought it would be nice to support 3 languages for the rest of the backend already is set to go.
I guess this error, now on a DLL or Windows App, I would use the root namespace and then the name of the file. ???? Maybe that's what I'm missing to register the file, a namespace.
Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "login.master.en-us.resources" was correctly embedded or linked into assembly "App_Web_dubrzsw3" at compile time, or that all the satellite assemblies required are loadable and fully signed.
So I made this folder call App_GlobalResources and put 3 files in it.
login.master.en-us.resx
login.master.fr-ca.resx
login.master.ex-mx.resx
Then in the master code behind page, I put this in pre-render, does the same thing page load
Imports System.Resources
Imports System.Globalization
Imports System.IO
Imports System.Reflection
Partial Class Masterpages_Admin_Login
Inherits System.Web.UI.MasterPage
Protected rm As ResourceManager
Protected ci As CultureInfo
Protected Sub Page_PreRender(sender As Object, e As EventArgs) Handles Me.PreRender
Dim m_context As HttpContext = HttpContext.Current
Dim m_localization As String = "english"
If Not (m_context.Request.QueryString("language") Is Nothing) Then
m_localization = m_context.Request.QueryString("language")
Select Case m_localization.ToLower
Case "english"
rm = New ResourceManager("login.master.en-us", Assembly.GetExecutingAssembly())
ci = New CultureInfo("en-US")
Case "french"
rm = New ResourceManager("login.master.fr-ca", Assembly.GetExecutingAssembly())
ci = New CultureInfo("fr-CA")
Case "spanish"
rm = New ResourceManager("login.master.es-mx", Assembly.GetExecutingAssembly())
ci = New CultureInfo("es-MX")
Case Else
rm = New ResourceManager("login.master.en-us", Assembly.GetExecutingAssembly())
ci = New CultureInfo("en-US")
End Select
Else
rm = New ResourceManager("login.master.en-us", Assembly.GetExecutingAssembly())
ci = New CultureInfo("en-US")
End If
End Sub
On the master page in Html, I put this in
<li class="pull-right"><a href="#top"><% rm.GetString("txtTop")%></a></li>
|
|
|
|
|
I figured it out, but the solution is long and complex
Basically, I'm going to create a new DLL that has nothing but resource strings
And call that DLL Assemby in Page Load of the Master Page.
Then use a Label Control, and populate that Label in Code Behind.
Partial Class Masterpages_Admin_Login
Inherits System.Web.UI.MasterPage
Public rm As ResourceManager
Public ci As CultureInfo
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim m_context As HttpContext = HttpContext.Current
Dim Assembly As System.Reflection.Assembly = System.Reflection.Assembly.Load("Admin_Standard")
If Not (m_context.Request.QueryString("language") Is Nothing) Then
Dim m_localization As String = m_context.Request.QueryString("language")
Select Case m_localization.ToLower
Case "english"
rm = New System.Resources.ResourceManager("Admin_Standard.labels_en", Assembly)
ci = New CultureInfo("en-US")
Case "french"
rm = New System.Resources.ResourceManager("Admin_Standard.labels_fr", Assembly)
ci = New CultureInfo("fr-CA")
Case "spanish"
rm = New System.Resources.ResourceManager("Admin_Standard.labels_es", Assembly)
ci = New CultureInfo("es-MX")
Case Else
rm = New System.Resources.ResourceManager("Admin_Standard.labels_en", Assembly)
ci = New CultureInfo("en-US")
End Select
Else
rm = New System.Resources.ResourceManager("Admin_Standard.labels_en", Assembly)
ci = New CultureInfo("en-US")
Dim m_string As String = rm.GetString("Back to top")
End If
lbl_BackToTop.Text = rm.GetString("txtTop")
End Sub
End Class
HTML
li class="pull-right"><a href="#top"><asp:Label ID="lbl_BackToTop" runat="server" Text="Back to top" /></a></li>
|
|
|
|
|
i have a one post then i wantto set for this post displaydate and display off date
from backend when i create post for ex title photos content displaystartdate and displayenddate input then save it
displaystartdate : 2015/10/2
displaystartdate : 2015/10/5
and front end when date 2015/10/2 my post automatically show up and when date is 2015/10/5 my post automatically off
there is my code who can check for me this something is wrong ~
thanks `
Protected Sub BindData(dt As Data.DataTable, SiteID As Long)
If dt.Rows.Count > 0 Then
litList.Text = ""
For i As Integer = 0 To dt.Rows.Count - 1
Dim Title As String = dt.Rows(i).Item("Title").ToString
Dim Targets As String = ""
Dim Targetsdes As String = ""
Dim ImgURL As String = ""
Dim ImgURLs As String = ""
Dim now As DateTime = DateTime.Now
Dim startTime As DateTime = dt.Rows(i).Item("DisplaySDate").ToString()
Dim endTime As DateTime = dt.Rows(i).Item("DisplayEDate").ToString()
If ((startTime <= DateTime.Now) And (endTime >= DateTime.Now)) Then
Me.Visible = True
Else
Me.Visible = False
End If
Dim URL As String = dt.Rows(i).Item("URL").ToString
If URL = "" Then
URL = "#"
Else
If dt.Rows(i).Item("Targets").ToString = True Then
Targets = " target=""_blank"" "
Targetsdes = Resources.RsAll.OpenNW
End If
End If
If dt.Rows(i).Item("Files").ToString <> "" Then
ImgURL = ViewState("Roots") & "WebTools/Thumbnail.ashx?Siteid=" & SiteID & "&MmmID=99&fd=Benner_Files&NW=696&NW=249&Pname=" & dt.Rows(i).Item("Files").ToString
End If
litList.Text &= "<li><a href=""" & URL & """ title=""" & Title & Targetsdes & """" & Targets & " ><img src=""" & ViewState("Roots") & "" & ImgURL & """ alt=""" & Title & """ /></a></li>"
litLists.Text &= "<li>"
litLists.Text &= "<div>"
If dt.Rows(i).Item("Files").ToString <> "" Then
ImgURLs = ViewState("Roots") & "WebTools/Thumbnail.ashx?Siteid=" & SiteID & "&MmmID=99&fd=Benner_Files&NW=71&NW=71&Pname=" & dt.Rows(i).Item("Filess").ToString
End If
litLists.Text &= "<a href=""#"" title=""" & Title & """><img src=""" & ViewState("Roots") & "" & ImgURLs & """ alt=""" & Title & """ title=""" & Title & """/></a>"
litLists.Text &= "<h4>" & dt.Rows(i).Item("contents").ToString & "</h4>"
litLists.Text &= "</div>"
litLists.Text &= "</li>"
Next
Else
Me.Visible = False
End If
dt.Dispose()
End Sub
|
|
|
|
|
In this kind of case the best and quickest way to find out the problem is to use the debugger. Place a breakpoint on the line
Dim startTime As DateTime = dt.Rows(i).Item("DisplaySDate").ToString()
and go through the line one-by-one. Investigate what are the values for
dt.Rows(i).Item("DisplaySDate")
and
dt.Rows(i).Item("DisplayEDate")
Could it be that that either one is empty or has a value you wouldn't expect.
Also I'd suggest using DirectCast instead of implicitly converting the string date to datetime.
|
|
|
|
|
I wanted to upload Multiple Files With ListBox in ASP.NET but there is an error at specific place....
The error on :
File.Add(FileUpload1);
It showing error on 'File.Add'
asp:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:FileUpload ID="FileUpload1" runat="server" AllowMultiple="true" style="z-index: 1; left: 420px; top: 315px; position: absolute; width: 285px; height: 22px" />
<asp:Button ID="btnUpload" Text="Add" runat="server" OnClick ="UploadMultipleFiles" accept ="image/gif, image/jpeg, application/exe" style="z-index: 1; left: 425px; top: 535px; position: absolute" />
<hr />
<asp:Label ID="lbl_text" runat="server" ForeColor ="Red" style="z-index: 1; left: 701px; top: 495px; position: absolute" />
<asp:ListBox ID="ListBox1" runat="server" style="z-index: 1; left: 415px; top: 371px; position: absolute; width: 280px; height: 147px; margin-left: 3px; margin-top: 0px"></asp:ListBox>
<asp:Button ID="btn_remove" runat="server" OnClick="btn_remove_Click" style="z-index: 1; left: 500px; top: 535px; position: absolute" Text="Remove" />
c#:
protected void UploadMultipleFiles(object sender, EventArgs e)
{
try
{
if (FileUpload1.HasFile)
{
if (FileUpload1.PostedFile.ContentLength > 0)
{
if (ListBox1.Items.Contains(new ListItem(System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName))))
{
lbl_text.Text = "File already in the ListBox";
}
else
{
File.Add(FileUpload1);
ListBox1.Items.Add(System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName));
lbl_text.Text = "Add another file or click Upload to save them all";
}
}
else
{
lbl_text.Text = "File size cannot be 0";
}
}
else
{
lbl_text.Text = "Please select a file to add";
}
}
catch (Exception ex)
{
}
}
protected void btn_remove_Click(object sender, EventArgs e)
{
if (ListBox1.Items.Count > 0)
{
if (ListBox1.SelectedIndex < 0)
{
Label1.Text = "Please select a file to remove";
}
else
{
File.RemoveAt(ListBox1.SelectedIndex);
ListBox1.Items.Remove(ListBox1.SelectedItem.Text);
lbl_text.Text = "File removed";
}
}
}
|
|
|
|
|